SPARQL and Subquery; 3rd go

Well; I gave up and found an easier way using straight rdflib methods; another day wasted. The tutorials on rdflib are pretty bad. So you just can’t jump straight in. Wordpress formatting sucks, I know; prolly should upgrade.

from rdflib import ConjunctiveGraph as Graph, Namespace

DublinCore = Namespace(”http://purl.org/dc/elements/1.1/”)

g = Graph()
g.parse(”sample.metadata”, format=”xml”)

creator_list = list(g.subject_objects(DublinCore["creator"]))
for data, blank_node in creator_list:
# We get the dc:creator sequence
sequence = g.seq(blank_node)
for creator in sequence:
print creator

Leave a Reply

You must be logged in to post a comment.