jekyll-rdf 3.0.0.pre.develop.343 → 3.0.0.pre.develop.344

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: e9255ac5d8912fd3200919a85fa010e84ea40ba9b8c47e8fcca1ad66788387ed
4
- data.tar.gz: 5a8c256c0d62129f3ec4cafa6fca75abb207660a29ace1b8e60825d4aa22b8a0
3
+ metadata.gz: 8a5089e3880e712203acf2b3deb70a59ce6dad048b965acdd54f6be284bf1442
4
+ data.tar.gz: be20ab2f11afdea8c8c488af094dc4ce14f45f05233726a86099b4175f5c84d7
5
5
  SHA512:
6
- metadata.gz: 4cd76f82301aa6628f57b5787b5f5b0ca1cdacf4ae5f3e1277e9526b80a0a05e5206e6d8e60311e48cc8f3738ce225981817695c42ae1aa09033eb0909f1359c
7
- data.tar.gz: fca2156b0169d18b5e9ce248b145cc8deec6eb52357937d70ed6924f9f604ee491997badf2d52d73128376c1d5acb8e490a28464d556a70e7f4f5f2ed1bffd47
6
+ metadata.gz: 7b35b1fc8c403310accc71e77854fb126cc68e45ffbdf068360f615a863fc61fa16d3358c29084796e130fde58fb6fc44588af26211c68f5f9b92f97bb2c5dd7
7
+ data.tar.gz: 25014443680f96aad9f3d7f6294272f0e020930261eaa7885658e50b5b7a44b8e978967b9d60e775ab11525bde1f49e795c2faf79bd8f24f4e6953f399d2db4e
data/lib/jekyll-rdf.rb CHANGED
@@ -52,6 +52,8 @@ require 'jekyll/filters/rdf_property'
52
52
  require 'jekyll/filters/rdf_collection'
53
53
  require 'jekyll/filters/rdf_container'
54
54
  require 'jekyll/filters/rdf_get'
55
+ require 'jekyll/filters/rdf_message'
56
+ require 'jekyll/filters/rdf_page_to_resource'
55
57
 
56
58
  Liquid::Template.register_filter(Jekyll::JekyllRdf::Filter)
57
59
  require 'jekyll/rdf_main_generator'
@@ -28,7 +28,7 @@ module Jekyll
28
28
  module JekyllRdf
29
29
  module Filter
30
30
  def rdf_collection(input, predicate = nil)
31
- input = Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'] if(input.nil? || input.class <= (Jekyll::RdfPageData))
31
+ input = rdf_page_to_resource(input)
32
32
  query = "SELECT ?f WHERE{ #{input.term.to_ntriples} " <<
33
33
  (predicate.nil? ? "" : " <#{rdf_resolve_prefix(predicate)}> ?coll . ?coll ") <<
34
34
  " <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}"
@@ -27,7 +27,7 @@ module Jekyll
27
27
  module JekyllRdf
28
28
  module Filter
29
29
  def rdf_container(input, type = nil)
30
- input = Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'] if(input.nil? || input.class <= (Jekyll::RdfPageData))
30
+ input = rdf_page_to_resource(input)
31
31
  sparql_client = Jekyll::JekyllRdf::Helper::RdfHelper::sparql
32
32
  n_triples = input.term.to_ntriples
33
33
  if(!(valid_container?(n_triples, type)))
@@ -32,7 +32,7 @@ module Jekyll
32
32
  #
33
33
  module Filter
34
34
  def rdf_get(request_uri)
35
- request_uri = "<#{Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'].term.to_s}>" if (request_uri.nil? || request_uri.class <= (Jekyll::RdfPageData))
35
+ request_uri = "<#{Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'].term.to_s}>" if (rdf_page_to_resource?(request_uri))
36
36
  request_uri = rdf_resolve_prefix(request_uri)
37
37
  ask_exist = "ASK WHERE {{<#{request_uri}> ?p ?o}UNION{?s <#{request_uri}> ?o}UNION{?s ?p <#{request_uri}>}} "
38
38
  return unless (Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(ask_exist).true?)
@@ -0,0 +1,25 @@
1
+ module Jekyll
2
+
3
+ module JekyllRdf
4
+
5
+ ##
6
+ # Internal module to hold the medthod #rdf_message
7
+ #
8
+ module Filter
9
+ def rdf_message(message, logLevel = "info") #:nodoc:
10
+ case logLevel
11
+ when "info"
12
+ Jekyll.logger.info message
13
+ when "warn"
14
+ Jekyll.logger.warn message
15
+ when "error"
16
+ Jekyll.logger.error message
17
+ when "debug"
18
+ Jekyll.logger.debug message
19
+ else
20
+ Jekyll.logger.info "NoLevel: #{message}"
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ module Jekyll
2
+ module JekyllRdf
3
+ module Filter
4
+ private
5
+ def rdf_page_to_resource(input)
6
+ return Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'] if(rdf_page_to_resource?(input))
7
+ return input
8
+ end
9
+
10
+ def rdf_page_to_resource?(input)
11
+ return (input.nil? || input.class <= (Jekyll::RdfPageData) || (input.class <= Hash && input.respond_to?(:template) && input.respond_to?(:url) && input.respond_to?(:path) ))
12
+ end
13
+ end
14
+ end
15
+ end
@@ -47,7 +47,7 @@ module Jekyll
47
47
 
48
48
  private
49
49
  def map_predicate(input, predicate, lang = nil, list = false, inverse = false)
50
- input = Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'] if(input.nil? || input.class <= (Jekyll::RdfPageData))
50
+ input = rdf_page_to_resource(input)
51
51
  return input unless input.is_a?(Jekyll::JekyllRdf::Drops::RdfResource)
52
52
  predicate = rdf_resolve_prefix(predicate)
53
53
  result = filter_statements(input.term.to_ntriples, predicate, inverse, lang)
@@ -38,7 +38,7 @@ module Jekyll
38
38
  # * +query+ - the SPARQL query
39
39
  #
40
40
  def sparql_query(resource = nil, query)
41
- if(resource.nil? || resource.class <= (Jekyll::RdfPageData))
41
+ if(rdf_page_to_resource?(resource))
42
42
  query.gsub!('?resourceUri', "<#{Jekyll::JekyllRdf::Helper::RdfHelper::page.data['rdf'].term}>")
43
43
  elsif(resource.class <= Array)
44
44
  resource.each_with_index do |uri, index|
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.343
4
+ version: 3.0.0.pre.develop.344
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elias Saalmann
@@ -169,6 +169,8 @@ files:
169
169
  - lib/jekyll/filters/rdf_collection.rb
170
170
  - lib/jekyll/filters/rdf_container.rb
171
171
  - lib/jekyll/filters/rdf_get.rb
172
+ - lib/jekyll/filters/rdf_message.rb
173
+ - lib/jekyll/filters/rdf_page_to_resource.rb
172
174
  - lib/jekyll/filters/rdf_property.rb
173
175
  - lib/jekyll/filters/rdf_resolve_prefix.rb
174
176
  - lib/jekyll/filters/rdf_sparql_query.rb