Skip to content

Normalize schema.org http/https at the rdflib boundary #163

Description

@simontaurus

rdflib binds SDO to https://schema.org/ and ships no http variant, so any code reaching for rdflib.namespace.SDO emits https predicates. OO-LD schemas bind http://schema.org/ (OO-LD/oold-schema#179). The two do not join, and nothing errors when they fail to.

import rdflib
g = rdflib.Graph()
g.add((rdflib.BNode(), rdflib.URIRef("http://schema.org/name"), rdflib.Literal("Alice")))
list(g.subject_objects(rdflib.namespace.SDO.name))   # []

That is RDFLib/rdflib#1120, closed as working-as-intended. The binding was described by its author as "a flip of the coin", and schema is bound to https://schema.org/ in every fresh Graph().

Ask

Normalize protocol variants at the rdflib boundary, without requiring a schema to declare the other form as an x-oold-context synonym. A user should not have to annotate every schema.org term to make a round-trip join.

Shape, to be settled in implementation:

  • Canonicalize on ingest rather than on export, so a graph built from any source presents one form internally.
  • Drive it from a small set of known protocol-variant vocabularies rather than a blanket http to https rewrite: a string replacement over all IRIs would also rewrite unrelated ones, and schema.org itself has terms like schema:httpMethod whose values contain the substring.
  • Keep it inspectable. Silent IRI rewriting is the same class of problem as the mismatch it fixes, so it belongs behind something a caller can see and disable.

Also in this repository

Two fixtures bind https and should follow oold-schema once OO-LD/oold-schema#180 lands:

  • tests/data/oold/UiAnnotations.schema.json:7
  • tests/test_backends.py:54

The vendored meta-schema copies under src/oold/validation/meta/1.0.0-rc.*/ also carry https://schema.org/Person, inherited from upstream. Those are frozen snapshots and pick up the change at the next vendored version; they do not need editing by hand.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions