jekyll-rdf 3.0.1.pre.develop.603 → 3.0.1.pre.develop.609
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jekyll/rdf_main_generator.rb +2 -0
- data/lib/jekyll/rdf_template_mapper.rb +39 -43
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60acf8bf7badc13104259acce8ef88567485c967035825d4ba45f610295876b6
|
4
|
+
data.tar.gz: '033170361298f9ea3b9c4933aff6d2c51808ef21b5cc01a352aa6d65f96ac87f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3b190598b4434f54295b1a43c2d2cedf0d5abd568f12db196e556a46140c1fc02e827daa23c2ce2c26a439de368e4594f4dcd347069de88aa3f710c8b8f7be
|
7
|
+
data.tar.gz: e980afbab5b7f38c7681fdca44223378fe2eadda3a2e12057e09b77d92b9a3b79701ab00629e3e76f0ca0e374bc55bd5c4bb7995443c9a4986f7de9f07f62328
|
@@ -30,20 +30,6 @@ module Jekyll
|
|
30
30
|
#
|
31
31
|
class RdfTemplateMapper
|
32
32
|
|
33
|
-
##
|
34
|
-
# A Hash mapping a resource to a template name
|
35
|
-
attr_accessor :resources_to_templates
|
36
|
-
|
37
|
-
##
|
38
|
-
# Default template name
|
39
|
-
attr_accessor :default_template
|
40
|
-
|
41
|
-
##
|
42
|
-
# A Hash mapping a type resource to a template name
|
43
|
-
attr_accessor :classes_to_templates
|
44
|
-
|
45
|
-
attr_accessor :classResources
|
46
|
-
|
47
33
|
include Jekyll::JekyllRdf::Helper::RdfClassExtraction
|
48
34
|
|
49
35
|
##
|
@@ -56,6 +42,7 @@ module Jekyll
|
|
56
42
|
@default_template = default_template
|
57
43
|
@classes_to_templates = classes_to_templates
|
58
44
|
@classResources = {}
|
45
|
+
@warnings = {}
|
59
46
|
create_resource_class(search_for_classes(sparql), sparql)
|
60
47
|
assign_class_templates(classes_to_templates)
|
61
48
|
end
|
@@ -65,39 +52,48 @@ module Jekyll
|
|
65
52
|
#
|
66
53
|
# Returns the template name of one of the +resource+'s types, if available. Returns the default template name otherwise.
|
67
54
|
def map(resource)
|
68
|
-
tmpl = resources_to_templates ? resources_to_templates[resource.term.to_s] : nil
|
55
|
+
tmpl = @resources_to_templates ? @resources_to_templates[resource.term.to_s] : nil
|
69
56
|
lock = -1
|
70
57
|
hier = -1
|
71
|
-
warn_mult_templ = false
|
72
58
|
duplicate_level_templ = []
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
if(
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
duplicate_level_templ.clear.push(tmpl)
|
84
|
-
if(classRes.multiple_templates?)
|
85
|
-
warn_mult_templ = true
|
86
|
-
duplicate_level_templ.concat(classRes.alternativeTemplates)
|
87
|
-
end
|
88
|
-
elsif(classRes.subClassHierarchyValue == hier)
|
89
|
-
warn_mult_templ = true
|
90
|
-
duplicate_level_templ.push(classRes.template)
|
59
|
+
resource.direct_classes.each do |classUri|
|
60
|
+
classRes = @classResources[classUri]
|
61
|
+
if((classRes.lock <= lock || lock == -1) && !classRes.template.nil?)
|
62
|
+
if(classRes.subClassHierarchyValue > hier)
|
63
|
+
lock = classRes.lock
|
64
|
+
tmpl = classRes.template
|
65
|
+
hier = classRes.subClassHierarchyValue
|
66
|
+
duplicate_level_templ.clear.push(tmpl)
|
67
|
+
if(classRes.multiple_templates?)
|
68
|
+
duplicate_level_templ.concat(classRes.alternativeTemplates)
|
91
69
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
70
|
+
elsif(classRes.subClassHierarchyValue == hier)
|
71
|
+
duplicate_level_templ.push(classRes.template)
|
72
|
+
end
|
73
|
+
end unless classRes.nil?
|
74
|
+
end if(tmpl.nil?)
|
75
|
+
add_warning(duplicate_level_templ.uniq, resource.iri) if (duplicate_level_templ.length > 1) && (Jekyll.env.eql? "development")
|
98
76
|
return tmpl unless tmpl.nil?
|
99
|
-
return default_template
|
77
|
+
return @default_template
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Add a warning for a resource having multiple possible templates
|
82
|
+
# The warnings are then later displayed with print_warnings
|
83
|
+
#
|
84
|
+
def add_warning(keys, iri)
|
85
|
+
keys.sort!
|
86
|
+
key = keys.join(', ')
|
87
|
+
@warnings[key] = [] if @warnings[key].nil? # using a hash ensures that a warning is printed only once for each combination of templates
|
88
|
+
# and for each resource at most once
|
89
|
+
@warnings[key].push(iri) unless @warnings[key].include? iri
|
100
90
|
end
|
101
|
-
end
|
102
91
|
|
103
|
-
|
92
|
+
def print_warnings
|
93
|
+
@warnings.delete_if{ |key, iris|
|
94
|
+
Jekyll.logger.warn("Warning: multiple possible templates for resources #{iris.join(", ")}\nPossible Templates: #{key}")
|
95
|
+
true
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end # RdfTemplateMapper
|
99
|
+
end #Jekyll
|
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.
|
4
|
+
version: 3.0.1.pre.develop.609
|
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-
|
21
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: net-http-persistent
|