diff options
author | Nicholas Car <nicholas.car@surroundaustralia.com> | 2021-12-09 15:09:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 15:09:58 +1000 |
commit | 98827692ca8a788b29685e740cfa693de61d7382 (patch) | |
tree | 469ff5561ecaef889c57859f08035c5475f61b85 | |
parent | f450bd68ec4088bfd6b6649d455b3d6ba6564d84 (diff) | |
parent | 7ceb97522fb7546e8011a70951d6e6213f48c332 (diff) | |
download | rdflib-98827692ca8a788b29685e740cfa693de61d7382.tar.gz |
Merge pull request #1491 from edmondchuc/feat/namespace-manager
Add bindings for rdflib namespaces. Import DCAM.
-rw-r--r-- | rdflib/namespace/__init__.py | 30 | ||||
-rw-r--r-- | test/test_sparql_service.py | 8 |
2 files changed, 33 insertions, 5 deletions
diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py index 4170b251..4b76366f 100644 --- a/rdflib/namespace/__init__.py +++ b/rdflib/namespace/__init__.py @@ -333,11 +333,38 @@ class NamespaceManager(object): self.__trie = {} for p, n in self.namespaces(): # self.bind is not always called insert_trie(self.__trie, str(n)) - self.bind("xml", XMLNS) + + # DefinedNamespace bindings. + self.bind("brick", BRICK) + self.bind("csvw", CSVW) + self.bind("dc", DC) + self.bind("dcat", DCAT) + self.bind("dcmitype", DCMITYPE) + self.bind("dcterms", DCTERMS) + self.bind("dcam", DCAM) + self.bind("doap", DOAP) + self.bind("foaf", FOAF) + self.bind("odrl", ODRL2) + self.bind("org", ORG) + self.bind("owl", OWL) + self.bind("prof", PROF) + self.bind("prov", PROV) + self.bind("qb", QB) self.bind("rdf", RDF) self.bind("rdfs", RDFS) + self.bind("schema", SDO) + self.bind("sh", SH) + self.bind("skos", SKOS) + self.bind("sosa", SOSA) + self.bind("ssn", SSN) + self.bind("time", TIME) + self.bind("vann", VANN) + self.bind("void", VOID) self.bind("xsd", XSD) + # Namespace bindings. + self.bind("xml", XMLNS) + def __contains__(self, ref): # checks if a reference is in any of the managed namespaces with syntax # "ref in manager". Note that we don't use "ref in ns", as @@ -703,6 +730,7 @@ from rdflib.namespace._DC import DC from rdflib.namespace._DCAT import DCAT from rdflib.namespace._DCMITYPE import DCMITYPE from rdflib.namespace._DCTERMS import DCTERMS +from rdflib.namespace._DCAM import DCAM from rdflib.namespace._DOAP import DOAP from rdflib.namespace._FOAF import FOAF from rdflib.namespace._ODRL2 import ODRL2 diff --git a/test/test_sparql_service.py b/test/test_sparql_service.py index 91cbb2d4..e22bd6ec 100644 --- a/test/test_sparql_service.py +++ b/test/test_sparql_service.py @@ -76,7 +76,7 @@ def test_service_with_implicit_select(): q = """select ?s ?p ?o where { - service <http://DBpedia.org/sparql> + service <https://DBpedia.org/sparql> { values (?s ?p ?o) {(<http://example.org/a> <http://example.org/b> 1) (<http://example.org/a> <http://example.org/b> 2)} }} limit 2""" @@ -93,7 +93,7 @@ def test_service_with_implicit_select_and_prefix(): select ?s ?p ?o where { - service <http://DBpedia.org/sparql> + service <https://DBpedia.org/sparql> { values (?s ?p ?o) {(ex:a ex:b 1) (<http://example.org/a> <http://example.org/b> 2)} }} limit 2""" @@ -110,7 +110,7 @@ def test_service_with_implicit_select_and_base(): select ?s ?p ?o where { - service <http://DBpedia.org/sparql> + service <https://DBpedia.org/sparql> { values (?s ?p ?o) {(<a> <b> 1) (<a> <b> 2)} }} limit 2""" @@ -126,7 +126,7 @@ def test_service_with_implicit_select_and_allcaps(): q = """SELECT ?s WHERE { - SERVICE <http://dbpedia.org/sparql> + SERVICE <https://dbpedia.org/sparql> { ?s <http://www.w3.org/2002/07/owl#sameAs> ?sameAs . } |