rdf-isomorphic 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/README +2 -1
- data/VERSION +1 -1
- data/lib/rdf/isomorphic.rb +13 -17
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NmNlNjFiYzY1MmQwN2UyYTNmY2M5NjkzZTczYzUzYjUxYjkwNmEzZGMxZjFm
|
10
|
-
MmYxYjBhYmJjNDA1OWQ4MzA4NzY1YmU5MGU4ZDZhYTEwOTY0NWFkNWM1MmJh
|
11
|
-
NTRmMTc2YjA0MDc3YzU1MzU1NzIwN2Q2OGYyYWY4MjkwMzJhZmM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZjE3ZTBjNDllYTEzMzU0MjM1Njc5MGUyZDQyMTllOTFlNjg4YWE2NmE2NWRj
|
14
|
-
OTk1MjAzMGRiN2UwZTFkNmU1ODA0ODg0ODVjZWEyY2MwMjdhOTEyODFjOTYw
|
15
|
-
ZDk2YjBkYjliNWY5OGEwNzg3ZTM0Zjg4MWU0MzUxNjUxMzYwNzc=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bef4e5a262cae34f69a3215aead4bd46e4a67c5c
|
4
|
+
data.tar.gz: cdfb92c433a387157340f54e3d498f17d472cb6a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ce60d7f0f65675e1ed60ddc5109d192b6cf2972947f3b41b3c2b780dae79427b9db8956722eb38cbbb42b6a6edbfffb4d03bee5dd5cedc0bb6627411915ff117
|
7
|
+
data.tar.gz: 0cf08692c08d88ce89fc64f7f23c1c79282ee8c5dfdae5538576680bf76ac90aeb5f8aaa1b19cdd3e2aa99342256479e74452306bf5d0bfbd4abd363b42543b8
|
data/README
CHANGED
@@ -5,7 +5,8 @@ That includes RDF::Repository, RDF::Graph, query results, and more.
|
|
5
5
|
|
6
6
|
For more information about RDF.rb, see <http://rdf.rubyforge.org>
|
7
7
|
|
8
|
-
[![
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/rdf-isomorphic.png)](http://badge.fury.io/rb/rdf-isomorphic)
|
9
|
+
[![Build Status](https://travis-ci.org/ruby-rdf/rdf-isomorphic.png)](https://travis-ci.org/ruby-rdf/rdf-isomorphic)
|
9
10
|
|
10
11
|
## Synopsis:
|
11
12
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/rdf/isomorphic.rb
CHANGED
@@ -9,7 +9,7 @@ module RDF
|
|
9
9
|
#
|
10
10
|
# RDF::Isomorphic provides the functions isomorphic_with and bijection_to for RDF::Enumerable.
|
11
11
|
#
|
12
|
-
# @see http://
|
12
|
+
# @see http://rdf.rubyforge.org
|
13
13
|
# @see http://www.hpl.hp.com/techreports/2001/HPL-2001-293.pdf
|
14
14
|
module Isomorphic
|
15
15
|
autoload :VERSION, 'rdf/isomorphic/version'
|
@@ -159,14 +159,10 @@ module RDF
|
|
159
159
|
|
160
160
|
# Blank nodes appearing in given list of statements
|
161
161
|
# @private
|
162
|
-
# @
|
162
|
+
# @param [Array<RDF::Statement>] blank_stmt_list
|
163
|
+
# @return [Array<RDF::Node>]
|
163
164
|
def self.blank_nodes_in(blank_stmt_list)
|
164
|
-
|
165
|
-
blank_stmt_list.each do | statement |
|
166
|
-
nodes << statement.object if statement.object.node?
|
167
|
-
nodes << statement.subject if statement.subject.node?
|
168
|
-
end
|
169
|
-
nodes.uniq
|
165
|
+
blank_stmt_list.map {|statement | statement.to_quad.compact.select(&:node?)}.flatten.uniq
|
170
166
|
end
|
171
167
|
|
172
168
|
# Given a set of statements, create a mapping of node => SHA1 for a given
|
@@ -230,14 +226,18 @@ module RDF
|
|
230
226
|
# Returns a tuple consisting of grounded being true or false and the String
|
231
227
|
# for the hash
|
232
228
|
# @private
|
229
|
+
# @param [RDF::Node] node
|
230
|
+
# @param [Array<RDF::Statement>] statements
|
231
|
+
# @param [Hash] hashes
|
232
|
+
# @param [Boolean] canonicalize
|
233
233
|
# @return [Boolean, String]
|
234
234
|
def self.node_hash_for(node, statements, hashes, canonicalize)
|
235
235
|
statement_signatures = []
|
236
236
|
grounded = true
|
237
237
|
statements.each do | statement |
|
238
|
-
if
|
238
|
+
if statement.to_quad.include?(node)
|
239
239
|
statement_signatures << hash_string_for(statement, hashes, node, canonicalize)
|
240
|
-
|
240
|
+
statement.to_quad.compact.each do | resource |
|
241
241
|
grounded = false unless grounded?(resource, hashes) || resource == node
|
242
242
|
end
|
243
243
|
end
|
@@ -252,11 +252,7 @@ module RDF
|
|
252
252
|
# return [String]
|
253
253
|
# @private
|
254
254
|
def self.hash_string_for(statement, hashes, node, canonicalize)
|
255
|
-
|
256
|
-
string << string_for_node(statement.subject, hashes, node, canonicalize)
|
257
|
-
string << statement.predicate.to_s
|
258
|
-
string << string_for_node(statement.object, hashes, node, canonicalize)
|
259
|
-
string
|
255
|
+
statement.to_quad.map {|r| string_for_node(r, hashes, node, canonicalize)}.join("")
|
260
256
|
end
|
261
257
|
|
262
258
|
# Returns true if a given node is grounded
|
@@ -275,6 +271,8 @@ module RDF
|
|
275
271
|
# @private
|
276
272
|
def self.string_for_node(node, hashes,target, canonicalize)
|
277
273
|
case
|
274
|
+
when node.nil?
|
275
|
+
""
|
278
276
|
when node == target
|
279
277
|
"itself"
|
280
278
|
when node.node? && hashes.member?(node)
|
@@ -296,7 +294,5 @@ module RDF
|
|
296
294
|
module Enumerable
|
297
295
|
include RDF::Isomorphic
|
298
296
|
end
|
299
|
-
|
300
|
-
autoload :VERSION, 'rdf/isomorphic/version'
|
301
297
|
end
|
302
298
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-isomorphic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Lavender
|
@@ -9,62 +9,62 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rdf-spec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '1.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - '>='
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 2.12.0
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 2.12.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: yard
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.8.3
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 0.8.3
|
70
70
|
description: RDF.rb plugin for graph bijections and isomorphic equivalence.
|
@@ -79,7 +79,7 @@ files:
|
|
79
79
|
- VERSION
|
80
80
|
- lib/rdf/isomorphic/version.rb
|
81
81
|
- lib/rdf/isomorphic.rb
|
82
|
-
homepage: http://github.com/
|
82
|
+
homepage: http://ruby-rdf.github.com/rdf-isomorphic
|
83
83
|
licenses:
|
84
84
|
- Public Domain
|
85
85
|
metadata: {}
|
@@ -89,12 +89,12 @@ require_paths:
|
|
89
89
|
- lib
|
90
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - '>='
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 1.8.2
|
95
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - '>='
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|