jekyll-rdf 2.1.0.alpha.pre.197 → 2.1.0.alpha.pre.201

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbf34538876ce9373c2fa03b290911afe2d1dadd
4
- data.tar.gz: c61e0ef454677b0b1f79da11b2c7c01af82d2a04
3
+ metadata.gz: bd60a0003f302e1b4bcb7bb0c828ec0db09e30c2
4
+ data.tar.gz: dee1d0a564a39da169766c466d65d219d980b95b
5
5
  SHA512:
6
- metadata.gz: 82857b46c0937271067ac74d046bd9e03b99a833cc55c7fa27b8d13a6b0c15b368ffbadcba183ee43e8ff994d27cdd98f880f1266391f4e5d1cb369b332d0545
7
- data.tar.gz: 3201742e0b797ad403d951f7c0150acf7b507ede1f67d86f4ef3ea683073b669c1b2be22cfccefa6acf3ea2f4ad92121905d7731396d58f2505e18e7b9fffa1b
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
- if(input.statements_as_subject.any?{ |statement|
30
- statement.predicate.to_s.eql? "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"
31
- })
32
- finalizedContainer = Set.new #avoid loops
33
- nodeSequence = [input.iri]
34
- nextSequence = []
35
- results = []
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 "<#{input.iri}> is not recognized as a container"
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{ <#{input.iri}> ?p ?o }"
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((solution.p.to_s[0..43].eql? "http://www.w3.org/1999/02/22-rdf-syntax-ns#_") && (solution.p.to_s[44..-1] !~ /\D/))
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
- ask_query_1 = "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.iri}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o}"
45
- ask_query_2 = "ASK WHERE {<#{input.iri}> <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>}"
46
- return (sparql_client.query(ask_query_1).true?) || (sparql_client.query(ask_query_2).true?)
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.197
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-18 00:00:00.000000000 Z
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