diff options
-rw-r--r-- | rdflib/namespace/_RDF.py | 1 | ||||
-rw-r--r-- | rdflib/namespace/__init__.py | 65 | ||||
-rw-r--r-- | test/test_namespace.py | 5 |
3 files changed, 5 insertions, 66 deletions
diff --git a/rdflib/namespace/_RDF.py b/rdflib/namespace/_RDF.py index 61bc4a58..f79d75a7 100644 --- a/rdflib/namespace/_RDF.py +++ b/rdflib/namespace/_RDF.py @@ -16,6 +16,7 @@ class RDF(DefinedNamespace): """ _fail = True + _underscore_num = True # http://www.w3.org/1999/02/22-rdf-syntax-ns#List nil: URIRef # The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it. diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py index 62a2a946..23f4ec0e 100644 --- a/rdflib/namespace/__init__.py +++ b/rdflib/namespace/__init__.py @@ -288,71 +288,6 @@ class ClosedNamespace(Namespace): return dir(self) -class _RDFNamespace(ClosedNamespace): - """ - Closed namespace for RDF terms - """ - - def __new__(cls): - return super().__new__( - cls, - "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - terms=[ - # Syntax Names - "RDF", - "Description", - "ID", - "about", - "parseType", - "resource", - "li", - "nodeID", - "datatype", - # RDF Classes - "Seq", - "Bag", - "Alt", - "Statement", - "Property", - "List", - "PlainLiteral", - # RDF Properties - "subject", - "predicate", - "object", - "type", - "value", - "first", - "rest", - # and _n where n is a non-negative integer - # RDF Resources - "nil", - # Added in RDF 1.1 - "XMLLiteral", - "HTML", - "langString", - # Added in JSON-LD 1.1 - "JSON", - "CompoundLiteral", - "language", - "direction", - ], - ) - - def term(self, name): - # Container membership properties - if name.startswith("_"): - try: - i = int(name[1:]) - except ValueError: - pass - else: - if i > 0: - return URIRef(f"{self}_{i}") - - return super().term(name) - - XMLNS = Namespace("http://www.w3.org/XML/1998/namespace") diff --git a/test/test_namespace.py b/test/test_namespace.py index 23fdb1e2..76f5bbf1 100644 --- a/test/test_namespace.py +++ b/test/test_namespace.py @@ -241,4 +241,7 @@ class NamespacePrefixTest(unittest.TestCase): ) ref = URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") - self.assertTrue(ref in RDF, "_RDFNamespace does not include rdf:type") + self.assertTrue(ref in RDF, "RDF does not include rdf:type") + + ref = URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#_1") + self.assertTrue(ref in RDF, "RDF does not include rdf:_1") |