Skip to content

Commit

Permalink
Fix: monkey path RDF to not remove xsd:string by default
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Feb 29, 2024
1 parent cb03c48 commit 1be1c83
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
7 changes: 3 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ontoportal-lirmm/sparql-client.git
revision: aed51baf4106fd0f3d0e3f9238f0aad9406aa3f0
revision: 180c818f7715baac64b2699bb452ef5c756f62c5
branch: master
specs:
sparql-client (1.0.1)
Expand Down Expand Up @@ -141,8 +141,7 @@ GEM
macaddr (~> 1.0)

PLATFORMS
ruby
x86_64-darwin-16
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
Expand All @@ -164,4 +163,4 @@ DEPENDENCIES
uuid

BUNDLED WITH
2.4.21
2.2.33
33 changes: 16 additions & 17 deletions lib/goo/mixins/sparql_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,25 @@ def validate?
end
end

class Literal
def to_base
text = []
text << %("#{escape(value)}")
text << "@#{language}" if has_language?
if has_datatype?
if datatype.respond_to?:to_base
text << "^^#{datatype.to_base}"
else
text << "^^<#{datatype.to_s}>"
end
end
text.join ""
end
end


class Literal
class DateTime < Temporal
FORMAT = '%Y-%m-%dT%H:%M:%S'.freeze # the format that is supported by 4store
end

def initialize(value, language: nil, datatype: nil, lexical: nil, validate: false, canonicalize: false, **options)
@object = value.freeze
@string = lexical if lexical
@string = value if !defined?(@string) && value.is_a?(String)
@string = @string.encode(Encoding::UTF_8).freeze if instance_variable_defined?(:@string)
@object = @string if instance_variable_defined?(:@string) && @object.is_a?(String)
@language = language.to_s.downcase.to_sym if language
@datatype = RDF::URI(datatype).freeze if datatype
@datatype ||= self.class.const_get(:DATATYPE) if self.class.const_defined?(:DATATYPE)
@datatype ||= instance_variable_defined?(:@language) && @language ? RDF.langString : RDF::URI("http://www.w3.org/2001/XMLSchema#string")
@original_datatype = datatype
end

attr_reader :original_datatype
end

end #end RDF

0 comments on commit 1be1c83

Please sign in to comment.