A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/RDFLib/rdflib/issues/2348 below:

NamespaceManager.expand_curie() does not handle the default prefix · Issue #2348 · RDFLib/rdflib · GitHub

I have found that rdflib's handling of cURIEs for entities within an ontology's own namespace is somewhat difficult.

One of the issues is already documented (#2077) - namely, that NamesapceManager does not handle mapping multiple prefixes to a single URI.

I also see that a cURIE like :my_class is rejected by expand_curie() as invalid. It seems like it should be valid though, based on https://www.w3.org/TR/curie/#s_syntax, in particular

A host language MAY declare a default prefix value, or MAY provide a mechanism for defining a default prefix value. In such a host language, when the prefix is omitted from a CURIE, the default prefix value MUST be used.

rdflib does record the default prefix value, mapping it to the empty string, as can be seen by examining NamespaceManager.namespaces() - but that default value is never used in expand_curie(). The problematic code appears to be

if len(parts) != 2 or len(parts[0]) < 1:

, which requires that the prefix in CURIE to be expanded has non-zero length - but that's in conflict with the (correct) storage of the default prefix in

namespaces()

.

The two issues make it difficult (impossible?) to expand a CURIE for an entity in the default namespace of an ontology:

Is there a workaround via which I could write a CURIE that maps to an item in a parsed ontology (e.g. one stored in RDF/XML), such that rdflib could expand it to the correct URI?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4