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 +4 -4
- data/lib/jekyll/filters/rdf_container.rb +4 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9895806546816486c2426c4e1ebfeb95dabb9df3427afe9798b3b18676b807fa
|
4
|
+
data.tar.gz: 1b8bf9b6537b8b2179815892fb579447212df71372ea479211163b8986f2b54f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
-
|
35
|
-
|
36
|
-
|
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
|