You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug inserting RDF-XML based graphs into repositories.
I am able to insert NTriple based readers into a Sesame repository. However, RDFXML ones cannot be inserted. Here's what I've been trying:
require 'rdf'
require 'rdf/sesame'
require 'rdf/rdfxml'
repository = RDF::Sesame::Repository.new('http://localhost:8080/openrdf-sesame/repositories/test')
I am able to get this to work with the RDF Context gem:
require 'rdf'
require 'rdf/sesame'
require 'rdf_context'
url = "http://localhost:8080/openrdf-sesame/repositories/test"
repository = RDF::Sesame::Repository.new(url)
The doap.xml file fails but rdf.xml does get parsed correctly
Bug inserting RDF-XML based graphs into repositories.
I am able to insert NTriple based readers into a Sesame repository. However, RDFXML ones cannot be inserted. Here's what I've been trying:
require 'rdf'
require 'rdf/sesame'
require 'rdf/rdfxml'
repository = RDF::Sesame::Repository.new('http://localhost:8080/openrdf-sesame/repositories/test')
Successfully returns count of 47
reader = RDF::NTriples::Reader.new(File.read(RAILS_ROOT + '/public/doap.nt'))
repository.clear
repository.insert(reader)
repository.count
Only returns count of 3
reader = RDF::RDFXML::Reader.new(File.read(RAILS_ROOT + '/public/doap.xml'))
repository = RDF::Sesame::Repository.new('http://localhost:8080/openrdf-sesame/repositories/test')
repository.clear
repository.insert(reader)
repository.count
Graph count returns 47, but insertion into repository fails
stream = File.open(RAILS_ROOT + '/public/doap.xml')
graph = RDF::Graph.new
RDF::RDFXML::Reader.new(stream).each { |s| graph << s }
puts graph.count
Now that we have a graph, insert into repository
This inserts 3 entries, but not the entire 47
repository.clear
repository.insert(graph.to_a)
repository.count
Same thing, returns 3
repository.clear
repository.insert(*graph.to_a)
repository.count
Same thing, returns 3
repository.clear
repository<<graph.to_rdf
repository.count
The << method in writable.rb looks like it detects a graph and then
calls insert_graph, but none of these seem to work either
repository<<graph
repository.insert(graph)
repository.insert(graph.to_ntriples)
repository.insert(_graph.to_ntriples)
graph.each { |s| repository << s }
graph.each { |s| repository.insert(_s) }
graph.each { |s| repository.insert(s) }
stream = File.open(RAILS_ROOT + '/public/doap.xml')
graph = RDF::Graph.new
RDF::RDFXML::Reader.new(stream).each { |s| graph << s }
reader = RDF::NTriples::Reader.new(graph.to_ntriples)
repository.insert(reader)
I am able to get this to work with the RDF Context gem:
require 'rdf'
require 'rdf/sesame'
require 'rdf_context'
url = "http://localhost:8080/openrdf-sesame/repositories/test"
repository = RDF::Sesame::Repository.new(url)
The doap.xml file fails but rdf.xml does get parsed correctly
f = File.open(RAILS_ROOT + '/public/rdf.xml')
graph = RdfContext::Graph.new
graph.parse(f.read, nil, :type => :rdfxml)
statements = RDF::NTriples::Reader.new(graph.to_ntriples)
repository.insert(*statements)
repository.count
repository.clear!
The text was updated successfully, but these errors were encountered: