1 """Helper features for working with librdf
6 # standard ontology namespaces
7 dublinCoreNS = RDF.NS("http://purl.org/dc/elements/1.1/")
8 rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
9 rdfsNS= RDF.NS("http://www.w3.org/2000/01/rdf-schema#")
10 xsdNS = RDF.NS("http://www.w3.org/2001/XMLSchema#")
13 submitOntology = RDF.NS("http://jumpgate.caltech.edu/wiki/UCSCSubmissionOntology#")
14 libraryOntology = RDF.NS("http://jumpgate.caltech.edu/wiki/LibraryOntology#")
16 def blankOrUri(value=None):
20 elif type(value) in types.StringTypes:
21 node = RDF.Node(uri_string=value)
22 elif isinstance(value, RDF.Node):
28 def toTypedNode(value):
29 if type(value) == types.BooleanType:
30 value_type = xsdNS['boolean'].uri
35 elif type(value) in types.StringTypes:
36 value_type = xsdNS['string'].uri
39 value = unicode(value)
41 return RDF.Node(literal=value, datatype=value_type)