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
Christopher Warner is part genius, part idiot. This makes him well balanced. He's worked on numerous opensource projects with great people and has generally led an eventful and fulfilling life. He hopes to retire an old man in a rocking chair should he be so fortunate.
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.
Related Posts:
About Christopher Warner
Christopher Warner is part genius, part idiot. This makes him well balanced. He's worked on numerous opensource projects with great people and has generally led an eventful and fulfilling life. He hopes to retire an old man in a rocking chair should he be so fortunate.