rdf-virtuoso 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/rdf/virtuoso/query.rb +4 -2
- data/lib/rdf/virtuoso/repository.rb +1 -1
- data/lib/rdf/virtuoso/version.rb +1 -1
- data/spec/query_spec.rb +7 -0
- data/spec/repository_spec.rb +11 -5
- data/spec/spec_helper.rb +5 -2
- metadata +6 -6
data/README.md
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
The intent of this class is to act as an abstraction for clients wishing to connect and manipulate linked data stored in a Virtuoso Quad store.
|
3
3
|
|
4
4
|
## How?
|
5
|
-
RDF::Virtuoso::Repository
|
6
|
-
RDF::Virtuoso::Query
|
5
|
+
RDF::Virtuoso::Repository subclasses RDF::Repository built on RDF.rb and is the main connection class built on top of APISmith to establish the read and write methods to a Virtuoso store SPARQL endpoint.
|
6
|
+
RDF::Virtuoso::Query subclasses RDF::Query and adds SPARQL 1.1. update methods (insert, delete, aggregates, etc.).
|
7
7
|
|
8
8
|
For examples on use, please read:
|
9
|
-
./spec/
|
9
|
+
./spec/repository_spec.rb
|
10
10
|
and
|
11
11
|
./spec/query_spec.rb
|
12
12
|
|
data/lib/rdf/virtuoso/query.rb
CHANGED
@@ -269,8 +269,10 @@ module RDF::Virtuoso
|
|
269
269
|
# @param RDF::URI uri
|
270
270
|
# @return [Query]
|
271
271
|
def from_named(uri)
|
272
|
-
options[:from_named]
|
272
|
+
(options[:from_named] ||= []) << uri
|
273
273
|
self
|
274
|
+
#options[:from_named] = uri
|
275
|
+
#self
|
274
276
|
end
|
275
277
|
|
276
278
|
# @param RDF::URI uri
|
@@ -603,7 +605,7 @@ module RDF::Virtuoso
|
|
603
605
|
end
|
604
606
|
|
605
607
|
buffer << "FROM #{serialize_value(options[:from])}" if options[:from]
|
606
|
-
buffer << "FROM NAMED #{serialize_value(
|
608
|
+
options[:from_named].each {|from_named| buffer << "FROM NAMED #{serialize_value(from_named)}" } if options[:from_named]
|
607
609
|
|
608
610
|
|
609
611
|
unless patterns.empty? && ([:describe, :insert_data, :delete_data, :create, :clear, :drop].include?(form))
|
data/lib/rdf/virtuoso/version.rb
CHANGED
data/spec/query_spec.rb
CHANGED
@@ -138,6 +138,13 @@ describe RDF::Virtuoso::Query do
|
|
138
138
|
"SELECT ?s FROM <#{@graph1}> FROM NAMED <#{@graph2}> WHERE { GRAPH <#{@graph2}> { ?s ?p ?o . } }"
|
139
139
|
end
|
140
140
|
|
141
|
+
it "should support one SELECT FROM and multiple FROM NAMED" do
|
142
|
+
@graph1 = RDF::URI("a")
|
143
|
+
@graph2 = RDF::URI("b")
|
144
|
+
@graph3 = RDF::URI("c")
|
145
|
+
@query.select(:s).where([:s, :p, :o, :context => @graph2], [:s, :p, :o, :context => @graph3]).from(@graph1).from_named(@graph2).from_named(@graph3).to_s.should ==
|
146
|
+
"SELECT ?s FROM <#{@graph1}> FROM NAMED <#{@graph2}> FROM NAMED <#{@graph3}> WHERE { GRAPH <#{@graph2}> { ?s ?p ?o . } GRAPH <#{@graph3}> { ?s ?p ?o . } }"
|
147
|
+
end
|
141
148
|
|
142
149
|
it "should support SELECT with complex WHERE patterns" do
|
143
150
|
@query.select.where(
|
data/spec/repository_spec.rb
CHANGED
@@ -1,12 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
$:.unshift "."
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'rdf/spec/repository'
|
4
|
+
#require_relative '../lib/rdf/virtuoso/repository'
|
5
|
+
describe RDF::Virtuoso::Repository do
|
3
6
|
|
4
7
|
before(:each) do
|
5
8
|
@uri = "http://localhost:8890/sparql"
|
6
9
|
@update_uri = "http://localhost:8890/sparql-auth"
|
7
10
|
end
|
8
|
-
|
9
|
-
|
11
|
+
|
12
|
+
it "should mixin RDF::Repository" do
|
13
|
+
@repository = RDF::Virtuoso::Repository.new(@uri)
|
14
|
+
#it_should_behave_like RDF_Repository # not working!
|
15
|
+
end
|
16
|
+
|
10
17
|
it "should support connecting to a Virtuoso SPARQL endpoint" do
|
11
18
|
repo = RDF::Virtuoso::Repository.new(@uri)
|
12
19
|
repo.instance_variable_get("@sparul_endpoint").should == "/sparql"
|
@@ -26,5 +33,4 @@ describe RDF::Virtuoso do
|
|
26
33
|
repo = RDF::Virtuoso::Repository.new(@uri, :update_uri => @update_uri, :username => 'admin', :password => 'secret', :auth_method => 'digest')
|
27
34
|
repo.instance_variable_get("@sparul_endpoint").should == "/sparql-auth"
|
28
35
|
end
|
29
|
-
end
|
30
36
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-virtuoso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -100,16 +100,16 @@ extensions: []
|
|
100
100
|
extra_rdoc_files: []
|
101
101
|
files:
|
102
102
|
- README.md
|
103
|
+
- lib/rdf/virtuoso.rb
|
103
104
|
- lib/rdf/virtuoso/version.rb
|
104
|
-
- lib/rdf/virtuoso/
|
105
|
+
- lib/rdf/virtuoso/parser.rb
|
105
106
|
- lib/rdf/virtuoso/prefixes.rb
|
106
107
|
- lib/rdf/virtuoso/repository.rb
|
107
|
-
- lib/rdf/virtuoso/
|
108
|
-
- lib/rdf/virtuoso.rb
|
108
|
+
- lib/rdf/virtuoso/query.rb
|
109
109
|
- spec/repository_spec.rb
|
110
|
-
- spec/prefixes_spec.rb
|
111
110
|
- spec/query_spec.rb
|
112
111
|
- spec/spec_helper.rb
|
112
|
+
- spec/prefixes_spec.rb
|
113
113
|
homepage: https://github.com/digibib/rdf-virtuoso
|
114
114
|
licenses: []
|
115
115
|
post_install_message:
|