Commit 4cba8924 authored by Élodie Thiéblin's avatar Élodie Thiéblin
Browse files

[rdf] Use namespace for graph binding namespace

parent 37fc2c6d299e
......@@ -24,10 +24,11 @@ __docformat__ = "restructuredtext en"
class CWUserRDFAdapter(_CWUserRDFAdapter):
def triples(self):
yield from super().triples()
SIOC = self._use_namespace("sioc")
uri = URIRef(self.uri)
blog_entries = self._cw.find("BlogEntry", created_by=self.entity)
for entry in blog_entries.entities():
yield (uri, NAMESPACES["sioc"].creator_of, URIRef(entry.cwuri))
yield (uri, SIOC.creator_of, URIRef(entry.cwuri))
class BlogRDFAdapter(EntityRDFAdapter):
......@@ -35,9 +36,9 @@ class BlogRDFAdapter(EntityRDFAdapter):
__select__ = is_instance("Blog")
def triples(self):
SIOC = NAMESPACES["sioc"]
RDF = NAMESPACES["rdf"]
DCTERMS = NAMESPACES["dcterms"]
SIOC = self._use_namespace("sioc")
RDF = self._use_namespace("rdf")
DCTERMS = self._use_namespace("dcterms")
uri = URIRef(self.uri)
yield (uri, RDF.type, SIOC.Weblog)
yield (uri, DCTERMS.title, Literal(self.entity.dc_title()))
......@@ -57,9 +58,9 @@ class BlogEntryRDFAdapter(EntityRDFAdapter):
__select__ = is_instance("BlogEntry")
def triples(self):
SIOC = NAMESPACES["sioc"]
RDF = NAMESPACES["rdf"]
DCTERMS = NAMESPACES["dcterms"]
SIOC = self._use_namespace("sioc")
RDF = self._use_namespace("rdf")
DCTERMS = self._use_namespace("dcterms")
uri = URIRef(self.uri)
yield (uri, RDF.type, SIOC.BlogPost)
yield (uri, DCTERMS.title, Literal(self.entity.dc_title()))
......@@ -78,8 +79,8 @@ class MicroBlogRDFAdapter(BlogRDFAdapter):
def triples(self):
yield from super().triples()
SIOC = NAMESPACES["sioc"]
RDF = NAMESPACES["rdf"]
SIOC = self._use_namespace("sioc")
RDF = self._use_namespace("rdf")
uri = URIRef(self.uri)
yield(uri, RDF.type, SIOC.Microblog)
......@@ -90,8 +91,8 @@ class MicroBlogEntryRDFAdapter(BlogEntryRDFAdapter):
def triples(self):
yield from super().triples()
SIOC = NAMESPACES["sioc"]
RDF = NAMESPACES["rdf"]
SIOC = self._use_namespace("sioc")
RDF = self._use_namespace("rdf")
uri = URIRef(self.uri)
yield (uri, RDF.type, SIOC.MicroblogPost)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment