jekyll-rdf 3.0.1.pre.develop.597 → 3.0.1.pre.develop.603

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: 91cd64fba0c06af37f3a8fbb559eb197053b8a2e47b49af4607325a9d08f12a0
4
- data.tar.gz: 1750593ef6c2bf4696d2c2dae109dc5d0a96871236821d33a3eef9ff011b8017
3
+ metadata.gz: 69e331abb5f5d77a0ff200969d3a243f6de1e7cc8bce1b7c50c631b901a75e4b
4
+ data.tar.gz: 90420ef9c6886f68ebb125a92db4cf45b8a61ca7af662e4665cfcd0e211f761a
5
5
  SHA512:
6
- metadata.gz: f4193c72f8019d48953625d20793092c6ca781a807e25ae94e5a1d8bb073f59e4a6b9026fb3171ab64b2916bca0f35fe924ade56ae8e78245b73bb343a3ef4a4
7
- data.tar.gz: c3b27eb9c373e407316828e80007c1f008a5cdb539a97009dd0d982d54ca7b5cb2eafd684b6bc6ce8eb22e4eb6d12c5026e68732c42fe8181a81b28aaf6b6264
6
+ metadata.gz: 75b24f1cef6ef4ba1001472b20fddf541284bd50a8ff57742032c72f4df0114dbc81306214ea4bf99a1a281f36052dfda07704946219695c4939935c6e2c1a4c
7
+ data.tar.gz: dbfef75a4cb81f215148369bccd58a5c48f9a1628ac2eb851ed6b75b87d5720889a17788cd3939542d1c0620300da3ec2f1d311617d3819a15695fa7e79e9d90
@@ -25,7 +25,7 @@
25
25
 
26
26
  module Jekyll
27
27
  module JekyllRdf
28
- module Filter
28
+ module ResolvePrefixes
29
29
  private
30
30
  def rdf_resolve_prefix(predicate)
31
31
  if(predicate[0] == "<" && predicate[-1] == ">")
@@ -50,3 +50,11 @@ module Jekyll
50
50
  end
51
51
  end
52
52
  end
53
+
54
+ module Jekyll
55
+ module JekyllRdf
56
+ module Filter
57
+ include Jekyll::JekyllRdf::ResolvePrefixes
58
+ end
59
+ end
60
+ end
@@ -121,6 +121,17 @@ module Jekyll
121
121
  end.uniq
122
122
  end
123
123
 
124
+ def extract_list_resources path
125
+ file = File.open(path, "r")
126
+ result = []
127
+ file.each_line {|line|
128
+ line = line.strip
129
+ result.push(RDF::URI(line[1..-2])) if (line[0].eql? "<" )&& (line[-1].eql? ">")
130
+ }
131
+ file.close
132
+ result
133
+ end
134
+
124
135
  def create_page(site, resource, mapper)
125
136
  Jekyll::JekyllRdf::Helper::RdfPageHelper.prepare_resource resource, mapper
126
137
  page = Jekyll::Page.new(site, site.source, resource.filedir, resource.filename)
@@ -33,6 +33,7 @@ module Jekyll
33
33
  safe true
34
34
  priority :highest
35
35
  include Jekyll::JekyllRdf::Helper::RdfGeneratorHelper
36
+ include Jekyll::JekyllRdf::ResolvePrefixes
36
37
 
37
38
  ##
38
39
  # #generate performs the enrichment of a Jekyll::Site with rdf triples
@@ -67,7 +68,11 @@ module Jekyll
67
68
  Jekyll::JekyllRdf::Helper::RdfHelper::prefixes = File.join(site.source, @config['prefixes'].strip) unless @config['prefixes'].nil?
68
69
 
69
70
  # restrict RDF graph with restriction
70
- resources = extract_resources(@config['restriction'], @config['include_blank'], sparql)
71
+ resources = []
72
+ resources = resources + extract_resources(@config['restriction'], @config['include_blank'], sparql) unless @config['restriction'].nil?
73
+ resources = resources + extract_list_resources(File.join(site.config['source'], @config['restriction_file'])) unless @config['restriction_file'].nil?
74
+ resources = resources + extract_resources(nil, @config['include_blank'], sparql) if resources.length == 0 # subject + predicate + object should only be extracted if there is neither a restriction or restriction_file
75
+ resources.uniq! unless @config['restriction'].nil? || @config['restriction_file'].nil?
71
76
  site.data['sparql'] = sparql
72
77
  site.data['resources'] = []
73
78
 
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.1.pre.develop.597
4
+ version: 3.0.1.pre.develop.603
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elias Saalmann
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2018-11-17 00:00:00.000000000 Z
21
+ date: 2018-11-20 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: net-http-persistent