jekyll-rdf 3.0.0.pre.develop.544 → 3.0.0.pre.develop.549

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16d718822696064b4dd9770ab9ca577a0d2a5c25b033647ade9421457346278d
4
- data.tar.gz: 98d984c2c0c7800e8192c0fa955bdf27c52c69c3263b879acd02a233e282a899
3
+ metadata.gz: 9895806546816486c2426c4e1ebfeb95dabb9df3427afe9798b3b18676b807fa
4
+ data.tar.gz: 1b8bf9b6537b8b2179815892fb579447212df71372ea479211163b8986f2b54f
5
5
  SHA512:
6
- metadata.gz: aef044d8cc5984e3e52e5a53fd5319a872b402eca70189a51949c90846351565b9c2e7a53617a6015bfe63d9bf3100a52cad236c57dae2c75dc049fe42dc8bed
7
- data.tar.gz: 50f02fa377d226b842f9297cb10148d39aed2322053cb90d300f12489c6c7e955c2fdd14ae8bcc96f5030a4506b81348d2df6af4c009d3047edea41ec9ba2e61
6
+ metadata.gz: 1ad714542dfb526c5844a29f44874c8520dae7c3273f4862de8a7275df81b08ee0ca8b0c0be54e2944870c9584397188a111bd8aeb4845bef9c17c05ca6cfb29
7
+ data.tar.gz: 5dff4df965c0826655157de105a2289d87dae1b4401043967b5112647cdbb13ec43d3ed8007046e72a06b1fb030873f579735ba80c3b23da8fed9623e593d7df
@@ -26,16 +26,14 @@
26
26
  module Jekyll
27
27
  module JekyllRdf
28
28
  module Filter
29
- def rdf_container(input, type = nil)
29
+ def rdf_container(input, predicate = nil)
30
30
  input = rdf_page_to_resource(input)
31
31
  return unless valid_resource?(input)
32
32
  sparql_client = Jekyll::JekyllRdf::Helper::RdfHelper::sparql
33
33
  n_triples = to_string_wrap(input)
34
- if(!(valid_container?(n_triples, type)))
35
- Jekyll.logger.error "#{n_triples} is not recognized as a container"
36
- return []
37
- end
38
- query = "SELECT ?p ?o WHERE{ #{n_triples} ?p ?o #{query_additions()}"
34
+ query = "SELECT ?p ?o WHERE{ #{n_triples} " <<
35
+ (predicate.nil? ? "" : " #{rdf_resolve_prefix(predicate)} ?container . ?container ") <<
36
+ " ?p ?o #{query_additions()}"
39
37
  solutions = sparql_client.query(query).each_with_object([]) {|solution, array|
40
38
  if(/^http:\/\/www\.w3\.org\/1999\/02\/22-rdf-syntax-ns#_\d+$/.match(solution.p.to_s))
41
39
  array << Jekyll::JekyllRdf::Drops::RdfTerm.build_term_drop(solution.o, Jekyll::JekyllRdf::Helper::RdfHelper::site, true).add_necessities(Jekyll::JekyllRdf::Helper::RdfHelper::site, Jekyll::JekyllRdf::Helper::RdfHelper::page)
@@ -48,12 +46,6 @@ module Jekyll
48
46
  def query_additions()
49
47
  return "BIND((<http://www.w3.org/2001/XMLSchema#integer>(SUBSTR(str(?p), 45))) AS ?order) } ORDER BY ASC(?order)"
50
48
  end
51
-
52
- def valid_container?(n_triples, type = nil)
53
- ask_query1 = "ASK WHERE {VALUES ?o {<http://www.w3.org/2000/01/rdf-schema#Container> <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>} #{n_triples} <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o}"
54
- ask_query2 = "ASK WHERE {#{ n_triples } <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?o. ?o <http://www.w3.org/2000/01/rdf-schema#subClassOf>* <http://www.w3.org/2000/01/rdf-schema#Container>}"
55
- return (Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(ask_query1).true?) || (Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(ask_query2).true?)
56
- end
57
49
  end
58
50
  end
59
51
  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: 3.0.0.pre.develop.544
4
+ version: 3.0.0.pre.develop.549
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elias Saalmann