[ckan-changes] commit/ckanext-rdf: amercader: Fix broken imports and typo. Also used RDFS['label'] in arbitrary extras, as the RDF.label threw an excetion.

Bitbucket commits-noreply at bitbucket.org
Thu Jun 2 11:44:51 UTC 2011


1 new changeset in ckanext-rdf:

http://bitbucket.org/okfn/ckanext-rdf/changeset/f9f8d726b893/
changeset:   f9f8d726b893
branches:    
user:        amercader
date:        2011-06-02 13:44:41
summary:     Fix broken imports and typo. Also used RDFS['label'] in arbitrary extras, as the RDF.label threw an excetion.
affected #:  2 files (332 bytes)

--- a/ckanext/rdf/produce.py	Thu Jun 02 10:51:48 2011 +0100
+++ b/ckanext/rdf/produce.py	Thu Jun 02 12:44:41 2011 +0100
@@ -3,8 +3,8 @@
 
 from pprint import pformat
 
-from vocab import Graph, URIRef, Literal
-from vocab import DC, DCAT, FOAF, LICENSES, OWL, RDF, RDFS, REV, SCOVO, UUID, VOID, XSD, OPMV, SKOS
+from vocab import Graph, URIRef, Literal, BNode
+from vocab import DC, DCAT, FOAF, OWL, RDF, RDFS, UUID, VOID, OPMV, SKOS, REV, SCOVO, XSD, LICENSES
 
 from util import parse_date
 
@@ -19,7 +19,7 @@
     rec.remove((None, None, None))
 
     rec.add((uri, RDF.type, DCAT.Dataset))
-    rec.add((uri, OWL.sameAs., UUID[data["id"]]))
+    rec.add((uri, OWL.sameAs, UUID[data["id"]]))
     rec.add((uri, DC.identifier, Literal(data["name"])))
 
     if data["url"] is not None and data["url"].strip():
@@ -56,7 +56,7 @@
     for tag in data["tags"]:
         rec.add((uri, DCAT.keyword, Literal(tag)))
 
-    if data["ratings_average"] is not None:
+    if "ratings_average" in data and data["ratings_average"] is not None:
         rec.add((uri,REV.rating,
                  Literal(data["ratings_average"], datatype=XSD.float)))
 
@@ -182,7 +182,9 @@
         extra = BNode()
         rec.add((uri, DC.relation, extra))
         rec.add((extra, RDF.value, Literal(value)))
-        rec.add((extra, RDF.label, Literal(key)))
+        #TODO Is this correct?
+        #rec.add((extra, RDF.label, Literal(key)))
+        rec.add((extra, RDFS["label"], Literal(key)))
 
 def _process_relationship(self, rec, uri, rdata):
     pass


--- a/ckanext/rdf/vocab.py	Thu Jun 02 10:51:48 2011 +0100
+++ b/ckanext/rdf/vocab.py	Thu Jun 02 12:44:41 2011 +0100
@@ -8,18 +8,21 @@
 rdflib.plugin.register('sparql', rdflib.query.Result,
                        'rdfextras.sparql.query', 'SPARQLQueryResult')
 
+DC = Namespace("http://purl.org/dc/terms/")
+DCAT = Namespace("http://www.w3.org/ns/dcat#")
 DCES = Namespace("http://purl.org/dc/elements/1.1/")
-DC = Namespace("http://purl.org/dc/terms/")
 FOAF = Namespace("http://xmlns.com/foaf/0.1/")
+LICENSES = Namespace("http://purl.org/okfn/licenses/")
+LOCAL = Namespace("http://opendatasearch.org/schema#")
 OPMV = Namespace("http://purl.org/net/opmv/ns#")
 OWL = Namespace("http://www.w3.org/2002/07/owl#")
+REV = Namespace("http://purl.org/stuff/rev#")
+SCOVO = Namespace("http://purl.org/NET/scovo#")
 SKOS = Namespace("http://www.w3.org/2004/02/skos/core#")
 VOID = Namespace("http://rdfs.org/ns/void#")
 UUID = Namespace("urn:uuid:")
-DCAT = Namespace("http://www.w3.org/ns/dcat#")
 TIME = Namespace("http://www.w3.org/2006/time#")
 VCARD = Namespace("http://www.w3.org/2006/vcard/ns#")
-LOCAL = Namespace("http://opendatasearch.org/schema#")
 
 namespaces = {
     "rdf": RDF,
@@ -34,6 +37,9 @@
     "dcat": DCAT,
     "vcard": VCARD,
     "local": LOCAL,
+    "rev": REV,
+    "scovo": SCOVO,
+    "licenses": LICENSES
 }
 
 def bind_ns(g):

Repository URL: https://bitbucket.org/okfn/ckanext-rdf/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list