jekyll-rdf 2.1.0.alpha.pre.197 → 2.1.0.alpha.pre.201
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/filters/rdf_collection.rb +7 -24
- data/lib/jekyll/filters/rdf_container.rb +7 -6
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd60a0003f302e1b4bcb7bb0c828ec0db09e30c2
|
4
|
+
data.tar.gz: dee1d0a564a39da169766c466d65d219d980b95b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c2692bd2f4e52a3ada1efa934af0cab6f14d276d4bdafbae79541f294d0a7ee0c0f14f27673b0fd36485a0f3a652643e2fbd521cdaddbbed3d2b34fb7e210b
|
7
|
+
data.tar.gz: 5d6620b8f61e690056495163acc394170b2067b26ff9b52c81af3ead14295a12f766574fdcebded932986e0684a99e3e2bfd36a5b1c28b6931d633ed5250013f
|
@@ -26,30 +26,13 @@
|
|
26
26
|
module Jekyll
|
27
27
|
module RdfCollection
|
28
28
|
def rdf_collection(input)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
sparqlClient = input.sparql
|
37
|
-
while(!nodeSequence.empty?)
|
38
|
-
currentContainer = nodeSequence.pop
|
39
|
-
query = "SELECT ?f ?r WHERE{ <#{currentContainer}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> ?r. <#{currentContainer}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?f}"
|
40
|
-
solutions = sparqlClient.query(query).each { |solution|
|
41
|
-
if((!solution.r.to_s.eql? "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil") && (finalizedContainer.add? solution.r))
|
42
|
-
nextSequence.push solution.r.to_s
|
43
|
-
end
|
44
|
-
results.push Jekyll::Drops::RdfTerm.build_term_drop(solution.f, input.sparql, input.site).add_necessities(input.site, input.page)
|
45
|
-
if(nodeSequence.empty?)
|
46
|
-
nodeSequence = nextSequence
|
47
|
-
nextSequence = []
|
48
|
-
end
|
49
|
-
}
|
50
|
-
end
|
51
|
-
return results
|
52
|
-
end
|
29
|
+
sparql_query = input.sparql
|
30
|
+
query = "SELECT ?f WHERE{ #{input.term.to_ntriples} <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest>* ?r. ?r <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?f}"
|
31
|
+
results = []
|
32
|
+
sparql_query.query(query).each{ |solution|
|
33
|
+
results.push Jekyll::Drops::RdfTerm.build_term_drop(solution.f, input.sparql, input.site).add_necessities(input.site, input.page)
|
34
|
+
}
|
35
|
+
return results
|
53
36
|
end
|
54
37
|
end
|
55
38
|
end
|
@@ -29,21 +29,22 @@ module Jekyll
|
|
29
29
|
def rdf_container(input, type = nil)
|
30
30
|
sparql_client = input.sparql
|
31
31
|
if(!(valid_container?(input, sparql_client, type)))
|
32
|
-
Jekyll.logger.error "
|
32
|
+
Jekyll.logger.error "#{input.term.to_ntriples} is not recognized as a container"
|
33
33
|
return []
|
34
34
|
end
|
35
|
-
query = "SELECT ?p ?o WHERE{
|
35
|
+
query = "SELECT ?p ?o WHERE{ #{input.term.to_ntriples} ?p ?o }"
|
36
36
|
solutions = sparql_client.query(query).each_with_object([]) {|solution, array|
|
37
|
-
if(
|
37
|
+
if(/^http:\/\/www\.w3\.org\/1999\/02\/22-rdf-syntax-ns#_\d+$/.match(solution.p.to_s))
|
38
38
|
array << Jekyll::Drops::RdfTerm.build_term_drop(solution.o, input.sparql, input.site).add_necessities(input.site, input.page)
|
39
39
|
end
|
40
40
|
}
|
41
41
|
return solutions
|
42
42
|
end
|
43
|
+
|
43
44
|
def valid_container?(input, sparql_client, type = nil)
|
44
|
-
|
45
|
-
|
46
|
-
return (sparql_client.query(
|
45
|
+
ask_query1 = "ASK WHERE {VALUES ?o {<http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt>} #{input.term.to_ntriples} <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o}"
|
46
|
+
ask_query2 = "ASK WHERE {#{input.term.to_ntriples} <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o. ?o <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Container>}"
|
47
|
+
return (sparql_client.query(ask_query1).true?) || (sparql_client.query(ask_query2).true?)
|
47
48
|
end
|
48
49
|
end
|
49
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.alpha.pre.
|
4
|
+
version: 2.1.0.alpha.pre.201
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elias Saalmann
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2017-07-
|
19
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: linkeddata
|
@@ -39,6 +39,9 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2.2'
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.2.1
|
42
45
|
type: :runtime
|
43
46
|
prerelease: false
|
44
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -46,6 +49,9 @@ dependencies:
|
|
46
49
|
- - "~>"
|
47
50
|
- !ruby/object:Gem::Version
|
48
51
|
version: '2.2'
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.2.1
|
49
55
|
- !ruby/object:Gem::Dependency
|
50
56
|
name: jekyll
|
51
57
|
requirement: !ruby/object:Gem::Requirement
|