Enable owl:sameAs smushing in a store
main"Smushing" is the process of merging identifiers that are stated to denote the same thing. By default, rdflib stores perform no smushing. You must opt-in when creating the graph.
To enable smushing for owl:sameAs, owl:InverseFunctionalProperty, and owl:FunctionalProperty, pass the feature names to the $rdf.graph() constructor:
const kb = $rdf.graph(['sameAs', 'InverseFunctionalProperty', 'FunctionalProperty'])How Smushing Works
- Equivalence: When
A owl:sameAs Bis added, the store chooses one node as canonical and re-indexes all statements under it. Queries for either identifier will return the merged data. - Internal Book-keeping: The store records the equivalence using the
http://www.w3.org/2007/ont/link#urinamespace. It adds a statement:<canonical> <http://www.w3.org/2007/ont/link#uri> <obsoleted> . - Discovery: You can use
store.uris(term)andstore.allAliases(node)to list identifiers. If a Fetcher is attached, equating nodes triggers a look-up of the newly-learned alias. - Metadata: The Fetcher also uses the
http://www.w3.org/2007/ont/link#namespace to record HTTP metadata (requests, responses, status codes) in a separate metadata graph. This can be cleared usingstore.removeMetadata(doc).
const kb = $rdf.graph(['sameAs', 'InverseFunctionalProperty', 'FunctionalProperty'])