semantic_naming 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/ontology_graph/graph.rb
CHANGED
@@ -50,18 +50,18 @@ module OntologyGraph
|
|
50
50
|
return unless(N::URI.active_rdf?)
|
51
51
|
|
52
52
|
# First select all classes and add them as nodes
|
53
|
-
class_qry = Query.new(N::URI).select(:class).where(:class, N::RDF.type, N::RDFS.Class)
|
53
|
+
class_qry = ActiveRDF::Query.new(N::URI).select(:class).where(:class, N::RDF.type, N::RDFS.Class)
|
54
54
|
types = class_qry.execute
|
55
55
|
types.each { |t| @class_hash[t.to_s] = ClassNode.new(t.to_s) }
|
56
56
|
|
57
57
|
# Now, look for all subclass relationships and add them
|
58
|
-
subtype_qry = Query.new(N::URI).distinct.select(:class, :subclass)
|
58
|
+
subtype_qry = ActiveRDF::Query.new(N::URI).distinct.select(:class, :subclass)
|
59
59
|
subtype_qry.where(:subclass, RDFS.subClassOf, :class)
|
60
60
|
subtype_list = subtype_qry.execute
|
61
61
|
subtype_list.each { |cl, subcl| add_relation(cl, subcl) }
|
62
62
|
|
63
63
|
# Flag all classes that are actually used
|
64
|
-
used_types_qry = Query.new(N::URI).distinct.select(:type)
|
64
|
+
used_types_qry = ActiveRDF::Query.new(N::URI).distinct.select(:type)
|
65
65
|
used_types_qry.where(:element, RDF.type, :type)
|
66
66
|
used_types = used_types_qry.execute
|
67
67
|
used_types.each { |t| get_or_create_node(t).flag_used }
|
@@ -19,9 +19,9 @@ module N
|
|
19
19
|
# (e.g. Onotology classes)
|
20
20
|
def elements_with_type(type, element_type = N::URI)
|
21
21
|
return unless(rdf_active? && is_iri?)
|
22
|
-
qry = ::Query.new(element_type).distinct.select(:s)
|
22
|
+
qry = ActiveRDF::Query.new(element_type).distinct.select(:s)
|
23
23
|
qry.where(:s, RDF.type, type)
|
24
|
-
qry.
|
24
|
+
qry.regexp(:s, "^#{@uri_s}")
|
25
25
|
qry.execute
|
26
26
|
end
|
27
27
|
|
@@ -26,7 +26,7 @@ module N
|
|
26
26
|
# graph but cause an RDF query on each call
|
27
27
|
def instances(return_type)
|
28
28
|
return nil unless(active_rdf? && is_iri?)
|
29
|
-
qry = Query.new(URI).distinct.select(:s)
|
29
|
+
qry = ActiveRDF::Query.new(URI).distinct.select(:s)
|
30
30
|
qry.where(:s, RDF.type, self)
|
31
31
|
qry.execute
|
32
32
|
end
|
data/lib/semantic_naming/uri.rb
CHANGED
@@ -256,7 +256,7 @@ module N
|
|
256
256
|
# Check if the ActiveRDF library is present.
|
257
257
|
def self.active_rdf?
|
258
258
|
unless(defined?(@active_rdf))
|
259
|
-
@active_rdf = defined?(::ConnectionPool) && (::ConnectionPool.read_adapters.size > 0)
|
259
|
+
@active_rdf = defined?(ActiveRDF::ConnectionPool) && (ActiveRDF::ConnectionPool.read_adapters.size > 0)
|
260
260
|
end
|
261
261
|
|
262
262
|
@active_rdf
|
@@ -282,7 +282,7 @@ module N
|
|
282
282
|
# Gets the rdfs:labels from the rdf store
|
283
283
|
def rdfs_labels
|
284
284
|
if(active_rdf? && is_iri?)
|
285
|
-
labels = Query.new(N::URI).distinct.select(:label).where(self, N::RDFS.label, :label).execute
|
285
|
+
labels = ActiveRDF::Query.new(N::URI).distinct.select(:label).where(self, N::RDFS.label, :label).execute
|
286
286
|
if(labels && labels.size > 0)
|
287
287
|
labels
|
288
288
|
end # else nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_naming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Hahn
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-03-08 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|