diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-06-14 11:26:12 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-06-14 11:26:12 +0000 |
commit | ee778e08755cda60a1f48fc0a0491e6cdfccd0c5 (patch) | |
tree | 22139fb190297020c6916ecb6e3aa174d1bac2fd | |
parent | 31d0081654ba1593dfd56051b5d14f67541307c4 (diff) |
URI rewrite fixed
-rw-r--r-- | lib/4store.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/4store.rb b/lib/4store.rb index f2e3fcd..83cdb81 100644 --- a/lib/4store.rb +++ b/lib/4store.rb @@ -122,7 +122,6 @@ module OpenTox end def self.available? uri - #sparql = "SELECT DISTINCT ?s WHERE {GRAPH <#{uri}> {?s ?p ?o} }" sparql = "SELECT DISTINCT ?s WHERE {GRAPH <#{uri}> {?s <#{RDF.type}> <#{klass}>} }" r = query(sparql, nil) r.size == 1 and r.first == uri @@ -144,7 +143,10 @@ module OpenTox end bad_request_error "No class specified with <#{RDF.type}> statement." unless subject statements.each do |statement| - statement.subject = RDF::URI.new rewrite_uri if rewrite_uri and statement.subject == subject + if rewrite_uri + statement.subject = RDF::URI.new rewrite_uri if statement.subject.to_s == subject + statement.object = RDF::URI.new rewrite_uri if statement.predicate == RDF::XSD.anyURI + end rdf << statement end rdf |