Christopher Warner "So, it's not like the code is my brain; keep it"

21Aug/080

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

  • Share/Bookmark

About Christopher Warner

No description. Please complete your profile.
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

You must be logged in to post a comment.

No trackbacks yet.