Skip to content

Commit

Permalink
Merge pull request #64 from Harold-Solbrig/issue-34-use-rdflib-core-n…
Browse files Browse the repository at this point in the history
…amespace

Only use rdflib core namespace (non-polluting)
  • Loading branch information
cmungall authored Aug 8, 2023
2 parents 7f4aa7f + b09bf36 commit 03dd50f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion funowl/literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _to_n3(v: Any) -> Optional[rdflib.Literal]:
# Create a turtle triple to use the n3 parser
# TODO: make the constructor static and use clear
stmt = f'@prefix : <{DUMMY_PREFIX}> . @prefix xsd: <{XSD}> . :f a {v} .'
g = Graph()
g = Graph(bind_namespaces="core")
try:
g.parse(data=stmt, format="turtle")
except BadSyntax:
Expand Down
4 changes: 3 additions & 1 deletion funowl/prefix_declarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class PrefixDeclarations(NamespaceManager):
def __init__(self, g: Optional[Graph] = None) -> None:
self._init = True
self._prefixMap: Dict[str, Prefix] = dict()
super().__init__(g or Graph())
if g is None:
g = Graph(bind_namespaces="core")
super().__init__(g, bind_namespaces="core")
for prefix in PREFIX_PRESETS:
self.bind(prefix.prefixName, prefix.fullIRI)
self._init = False
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@

# rdflib 6.1.1 has a LONG list of pre-assigned prefixes. This breaks some of our tests and the rdflib
# community promises to fix it (some day...). For now, we won't run tests on this version
RDFLIB_PREFIXES_ARE_BROKEN = rdflib.__version__ >= "6.1.1"
RDFLIB_PREFIXES_ARE_BROKEN = rdflib.__version__ == "6.1.1"
PREFIXES_BROKEN_MESSAGE = "rdflib 6.1.1+ emits a LOT of prefixes. Test skipped!"

0 comments on commit 03dd50f

Please sign in to comment.