Archive for the ‘Semantic Web’ Category

We’re linked!

Monday, March 17th, 2008

Yes, now this blog is part of the Linked Data community. Thanks to triplify, all the posts and comments contained in this blog can be exported as RDF (N3 or JSON-encoded). The source is http://weblog.zarquon.biz/triplify/ (default: N3, use http://weblog.zarquon.biz/triplify/?t-output=json for RDF/JSON).

The output is still a single graph (much like a dump), but I’m confident that the triplify guys will soon start using different contexts, and make the URIs browsable.  In any case, it’s already possible to link these data with, i.e. FOAF info, using  foaf:mbox_sha1sum.

Contexts in rdflib

Friday, February 29th, 2008

A short example…

  1. from rdflib import Namespace, BNode, Literal, URIRef
  2. from rdflib.Graph import Graph, ConjunctiveGraph
  3. from rdflib.store.IOMemory import IOMemory
  4.  
  5. ns = Namespace("http://love.com#")
  6.  
  7. mary = URIRef("http://love.com/lovers/mary#")
  8. john = URIRef("http://love.com/lovers/john#")
  9.  
  10. cmary=URIRef("http://love.com/lovers/mary#")
  11. cjohn=URIRef("http://love.com/lovers/john#")
  12.  
  13. store = IOMemory()
  14.  
  15. g = ConjunctiveGraph(store=store)
  16. g.bind("love",ns)
  17.  
  18. gmary = Graph(store=store, identifier=cmary)
  19.  
  20. gmary.add((mary, ns[‘hasName’], Literal("Mary")))
  21. gmary.add((mary, ns[‘loves’], john))
  22.  
  23. gjohn = Graph(store=store, identifier=cjohn)
  24. gjohn.add((john, ns[‘hasName’], Literal("John")))
  25.  
  26. #enumerate contexts
  27. for c in g.contexts():
  28.     print "—- %s " % c
  29.  
  30. #separate graphs
  31. print gjohn.serialize(format=‘n3′)
  32. print gmary.serialize(format=‘n3′)
  33.  
  34. #full graph
  35. print g.serialize(format=‘n3′)

An ontology for OODBMS/RDF mapping

Tuesday, February 12th, 2008

This is my first incursion through the unstable field of semantic web, in the context of my Master Thesis.

Hope you like it…