jekyll-rdf 2.1.3.pre.develop.257 → 2.1.3.pre.develop.261
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-rdf.rb +3 -0
- data/lib/jekyll/filters/rdf_get.rb +62 -0
- data/lib/jekyll/helper/rdf_general_helper.rb +55 -0
- data/lib/jekyll/hooks/rdf_page_pointer.rb +28 -0
- data/lib/jekyll/rdf_main_generator.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92780762aa614bcb3a93e3fdea78b655a463de22
|
4
|
+
data.tar.gz: 1ffc7b408880a9d84ca1d6adc4453f6c099ece69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c100668cd2cc6d91087d4d9acb231b6d64f2dba1b1dbcf6889adbe00cc5adc501c466b58439078165e6e5964cd66176c803de6239744ce2101c7a0a0e5524fc0
|
7
|
+
data.tar.gz: dcb8ca139463dd7d7aca99265b96adb9cedef6c025b22b48686a049152e4a3643e014a09734b59161d1618ed5e253d788b4783217d0fff50d1e7da24c950e225
|
data/lib/jekyll-rdf.rb
CHANGED
@@ -41,11 +41,14 @@ require 'jekyll/drops/rdf_resource_class'
|
|
41
41
|
require 'jekyll/exceptions/NoPrefixMapped'
|
42
42
|
require 'jekyll/exceptions/NoPrefixesDefined'
|
43
43
|
require 'jekyll/exceptions/UnMarkedUri'
|
44
|
+
require 'jekyll/helper/rdf_general_helper'
|
45
|
+
require 'jekyll/hooks/rdf_page_pointer'
|
44
46
|
require 'jekyll/filters/rdf_resolve_prefix'
|
45
47
|
require 'jekyll/filters/rdf_sparql_query'
|
46
48
|
require 'jekyll/filters/rdf_property'
|
47
49
|
require 'jekyll/filters/rdf_collection'
|
48
50
|
require 'jekyll/filters/rdf_container'
|
51
|
+
require 'jekyll/filters/rdf_get'
|
49
52
|
require 'jekyll/rdf_generator_helper'
|
50
53
|
require 'jekyll/rdf_main_generator'
|
51
54
|
require 'jekyll/rdf_page_helper'
|
@@ -0,0 +1,62 @@
|
|
1
|
+
##
|
2
|
+
# MIT License
|
3
|
+
#
|
4
|
+
# Copyright (c) 2016 Elias Saalmann, Christian Frommert, Simon Jakobi,
|
5
|
+
# Arne Jonas Präger, Maxi Bornmann, Georg Hackel, Eric Füg
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
#
|
25
|
+
|
26
|
+
module Jekyll
|
27
|
+
|
28
|
+
##
|
29
|
+
# Internal module to hold the medthod #rdf_get
|
30
|
+
#
|
31
|
+
module RdfGet
|
32
|
+
def rdf_get(request_uri)
|
33
|
+
request_uri = rdf_resolve_prefix_temp(request_uri)
|
34
|
+
ask_exist = "ASK WHERE {{<#{request_uri}> ?p ?o}UNION{?s <#{request_uri}> ?o}UNION{?s ?p <#{request_uri}>}} "
|
35
|
+
return unless (Jekyll::RdfHelper::sparql.query(ask_exist).true?)
|
36
|
+
Jekyll::Drops::RdfResource.new(RDF::URI(request_uri), Jekyll::RdfHelper::sparql, Jekyll::RdfHelper::site, Jekyll::RdfHelper::page)
|
37
|
+
end
|
38
|
+
|
39
|
+
#this is only temporary, we will use Jekyll::RdfPrefixResolver -> rdf_resolve_prefix when we fixed it to 3.0.0
|
40
|
+
private
|
41
|
+
def rdf_resolve_prefix_temp(predicate)
|
42
|
+
if(predicate[0] == "<" && predicate[-1] == ">")
|
43
|
+
return predicate[1..-2]
|
44
|
+
end
|
45
|
+
arr=predicate.split(":",2) #bad regex, would also devide 'http://example....' into 'http' and '//example....',even though it is already a complete URI; if 'PREFIX http: <http://...> is defined, 'http' in 'http://example....' could be mistaken for a prefix
|
46
|
+
if((arr[1].include? (":")) || (arr[1][0..1].eql?("//")))
|
47
|
+
raise UnMarkedUri.new(predicate, Jekyll::RdfHelper::page.data['template'])
|
48
|
+
end
|
49
|
+
if(!Jekyll::RdfHelper::page.data["rdf_prefixes"].nil?)
|
50
|
+
if(!Jekyll::RdfHelper::page.data["rdf_prefix_map"][arr[0]].nil?)
|
51
|
+
return arr[1].prepend(Jekyll::RdfHelper::page.data["rdf_prefix_map"][arr[0]])
|
52
|
+
else
|
53
|
+
raise NoPrefixMapped.new(predicate, Jekyll::RdfHelper::page.data['template'], arr[0])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
raise NoPrefixesDefined.new(predicate, Jekyll::RdfHelper::page.data['template'])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
Liquid::Template.register_filter(Jekyll::RdfGet)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
##
|
2
|
+
# MIT License
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017 Sebastian Zänker
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
module Jekyll
|
26
|
+
|
27
|
+
##
|
28
|
+
# Internal module to hold the medthod #rdf_get
|
29
|
+
#
|
30
|
+
module RdfHelper
|
31
|
+
def self.sparql= sparql
|
32
|
+
@@sparql = sparql
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.sparql
|
36
|
+
@@sparql
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.site= site
|
40
|
+
@@site = site
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.site
|
44
|
+
@@site
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.page= page
|
48
|
+
@@page = page
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.page
|
52
|
+
@@page
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
##
|
2
|
+
# MIT License
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017 Sebastian Zänker
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
|
26
|
+
Jekyll::Hooks.register :pages, :pre_render do |page|
|
27
|
+
Jekyll::RdfHelper::page = page
|
28
|
+
end
|
@@ -52,6 +52,9 @@ module Jekyll
|
|
52
52
|
graph = RDF::Graph.load(@config['path'])
|
53
53
|
sparql = SPARQL::Client.new(graph)
|
54
54
|
|
55
|
+
Jekyll::RdfHelper::sparql = sparql
|
56
|
+
Jekyll::RdfHelper::site = site
|
57
|
+
|
55
58
|
# restrict RDF graph with restriction
|
56
59
|
resources = extract_resources(@config['restriction'], @config['include_blank'], sparql)
|
57
60
|
site.data['sparql'] = sparql
|
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.3.pre.develop.
|
4
|
+
version: 2.1.3.pre.develop.261
|
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-08-
|
19
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: linkeddata
|
@@ -167,9 +167,12 @@ files:
|
|
167
167
|
- lib/jekyll/exceptions/UnMarkedUri.rb
|
168
168
|
- lib/jekyll/filters/rdf_collection.rb
|
169
169
|
- lib/jekyll/filters/rdf_container.rb
|
170
|
+
- lib/jekyll/filters/rdf_get.rb
|
170
171
|
- lib/jekyll/filters/rdf_property.rb
|
171
172
|
- lib/jekyll/filters/rdf_resolve_prefix.rb
|
172
173
|
- lib/jekyll/filters/rdf_sparql_query.rb
|
174
|
+
- lib/jekyll/helper/rdf_general_helper.rb
|
175
|
+
- lib/jekyll/hooks/rdf_page_pointer.rb
|
173
176
|
- lib/jekyll/rdf_class_extraction.rb
|
174
177
|
- lib/jekyll/rdf_generator_helper.rb
|
175
178
|
- lib/jekyll/rdf_main_generator.rb
|