Correct support for container membership properties (RDF._1).
@@ -224,10 +224,16 @@ class _RDFNamespace(ClosedNamespace):
)
def term(self, name):
+ # Container membership properties
+ if name.startswith('_'):
try:
- i = int(name)
- return URIRef("%s_%s" % (self.uri, i))
+ i = int(name[1:])
except ValueError:
+ pass
+ else:
+ if i > 0:
+ return URIRef("%s_%s" % (self.uri, i))
+
return super(_RDFNamespace, self).term(name)
