jekyll-rdf 3.0.1.pre.develop.579 → 3.0.1.pre.develop.581

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: 23402ccc98de331dd3e5a5adb29d4ffb21a1428adb048721c09c8b2752226d00
4
- data.tar.gz: 4ab8f5d76090c16b57c4c31d955e64272273b5b63cdabc9fc6630d4b1c14cde4
3
+ metadata.gz: 7fe7725feec07f050150b556d62b3098bc2e1adc136fa80015c595f6b9927a97
4
+ data.tar.gz: 651467ec96ff9b14ec4a9880f3a94cbfb3b393d055509c4c70ec5d08e4a48173
5
5
  SHA512:
6
- metadata.gz: 853671bcd727d1a3669d2ce5026a3098a2adcfe22e17c3c21528fcb55b1516ed1cd19bae36a0f22f3994e88c19a8f9b0bdbe75b5c62c5353b283a82eead046fc
7
- data.tar.gz: 8d4c6529f529dad7759aa4777a18e3754815ee61f7eca12477c3922ce2be186045b71c4d5f52d8453cf29ac9848d56328d54ae7b372eefc5d6c6bfc504a0ef5c
6
+ metadata.gz: 970eb4cd9f3ff41167dde74eb7ee85935b5023900fe064e41214e34ca72bde98ce805733dd79f26018f418275c5ba3602ece5587203156023c4a69b04e208bd4
7
+ data.tar.gz: 8a82c08902a9f257a9d6ecde34fc6ce10ee77cdbd9fbf3fe6242d84eb0b0af3210ae6fad46f9f2047b7e97e75d9fe92c4cff51d2aabc4c15efd69330e377b212
@@ -232,7 +232,9 @@ module Jekyll #:nodoc:
232
232
  def create_statement(subject_string, predicate_string, object_string, is_lit = nil, lang = nil, data_type = nil)
233
233
  subject = RDF::URI(subject_string)
234
234
  predicate = RDF::URI(predicate_string)
235
- if(!is_lit.nil?&&is_lit.true?)
235
+ if((!is_lit.nil? && (is_lit.class <= RDF::Literal::Integer) ) && is_lit.nonzero?)#TODO compatibility (to Virtuoso) shouldn't be done inline but in an external file
236
+ object = RDF::Literal(object_string, language: lang, datatype: RDF::URI(data_type))
237
+ elsif((!is_lit.nil? && (is_lit.class <= RDF::Literal::Boolean)) && is_lit.true?) #some endpoints return isLit as integer, some as boolean
236
238
  object = RDF::Literal(object_string, language: lang, datatype: RDF::URI(data_type))
237
239
  else
238
240
  object = RDF::URI(object_string)
@@ -37,7 +37,13 @@ module Jekyll
37
37
  return unless valid_resource?(request_uri) && (!request_uri[0..1].eql? "_:")
38
38
  request_uri = rdf_resolve_prefix(request_uri)
39
39
  ask_exist = "ASK WHERE {{#{request_uri} ?p ?o}UNION{?s #{request_uri} ?o}UNION{?s ?p #{request_uri}}} "
40
- Jekyll::JekyllRdf::Drops::RdfResource.new(RDF::URI(request_uri[1..-2]), Jekyll::JekyllRdf::Helper::RdfHelper::site, Jekyll::JekyllRdf::Helper::RdfHelper::page, (Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(ask_exist).true?))
40
+ exists = Jekyll::JekyllRdf::Helper::RdfHelper::sparql.query(ask_exist)
41
+ if(exists.instance_of? RDF::Literal::Boolean)
42
+ exists = exists.true?
43
+ else
44
+ exists = false || exists #take care of compatibility with virtuoso
45
+ end
46
+ Jekyll::JekyllRdf::Drops::RdfResource.new(RDF::URI(request_uri[1..-2]), Jekyll::JekyllRdf::Helper::RdfHelper::site, Jekyll::JekyllRdf::Helper::RdfHelper::page, exists)
41
47
  end
42
48
  end
43
49
  end
@@ -89,7 +89,7 @@ module Jekyll
89
89
  # Distinguishes the solution between an Literal and a Resource
90
90
  #
91
91
  def dist_literal_resource(solution)
92
- if solution.lit.true?
92
+ if((solution.lit.instance_of?(RDF::Literal::Boolean) && solution.lit.true? )|| (solution.lit.instance_of?(RDF::Literal::Integer) && solution.lit.nonzero?))#TODO compatibility (to Virtuoso) shouldn't be done inline but in an external file
93
93
  check = check_solution(solution)
94
94
  object = RDF::Literal(solution.o, language: check[:lang], datatype: RDF::URI(check[:dataType]))
95
95
  result = Jekyll::JekyllRdf::Drops::RdfLiteral.new(object)
@@ -48,8 +48,18 @@ module Jekyll
48
48
  Jekyll.logger.error("Outdated format in _config.yml:\n 'template_mapping' detected but the following keys must be used now instead:\n instance_template_mappings -> maps single resources to single layouts\n class_template_mappings -> maps entire classes of resources to layouts\nJekyll-RDF wont render any pages for #{site.source}")
49
49
  return false
50
50
  end
51
-
52
- graph = RDF::Graph.load( File.join( site.config['source'], @config['path']))
51
+ if(!@config['remote'].nil?)
52
+ if (@config['remote']['endpoint'].nil?)
53
+ raise ArgumentError, "When the key 'remote' is specified, another subkey 'endpoint' must be specified which contains the location of your graph."
54
+ else
55
+ graph = @config['remote']['endpoint'].strip
56
+ end
57
+ elsif(!@config['path'].nil?)
58
+ graph = RDF::Graph.load( File.join( site.config['source'], @config['path']))
59
+ else
60
+ Jekyll.logger.error("No sparql endpoint defined. Jumping out of jekyll-rdf processing.")
61
+ return false
62
+ end
53
63
  sparql = SPARQL::Client.new(graph)
54
64
 
55
65
  Jekyll::JekyllRdf::Helper::RdfHelper::sparql = sparql
@@ -58,6 +68,11 @@ module Jekyll
58
68
 
59
69
  # restrict RDF graph with restriction
60
70
  resources = extract_resources(@config['restriction'], @config['include_blank'], sparql)
71
+ Jekyll.logger.info "resources:"
72
+ resources.each{|resource|
73
+ Jekyll.logger.info "#{resource}"
74
+ }
75
+ Jekyll.logger.info "resources end"
61
76
  site.data['sparql'] = sparql
62
77
  site.data['resources'] = []
63
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.579
4
+ version: 3.0.1.pre.develop.581
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elias Saalmann
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '10.4'
99
+ - !ruby/object:Gem::Dependency
100
+ name: rest-client
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '1.8'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '1.8'
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: coveralls
101
115
  requirement: !ruby/object:Gem::Requirement