redlander 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b09461d5d5cd80ad9a79c65fb2fd666de0a2b058
4
+ data.tar.gz: c718bbdf065e54120d9a8e88395ff54730393a28
5
+ SHA512:
6
+ metadata.gz: 586c5258959e63cb20ab100cb564a1a587cf2d09b9b6ce0e76755b5524e8b64418e10701feb174051ba1cae8de802e9a4dfeb923fc0f4e82b241c6a6fc285bab
7
+ data.tar.gz: 325207a2c7d16f72686e74d38f6f9b54471511f8eee7c8684f67445ef7ad969d372c2be0ea494f43092f9f6d5e3063de4d9c0a6b45acb44eafa2c7b9e08ac2c1
data/README.md CHANGED
@@ -16,7 +16,7 @@ Note, that you will have to install Redland runtime library (librdf) for Redland
16
16
  # Usage
17
17
 
18
18
  This README outlines most obvious use cases.
19
- For more details please refer to YARD documentation of Redlander.
19
+ For more details please refer to [YARD documentation of Redlander](http://rubydoc.info/gems/redlander).
20
20
 
21
21
  To start doing anything useful with Redlander, you need to initialize a model first:
22
22
 
@@ -82,6 +82,16 @@ hash for *SELECT* queries. Binding hash values are instances of `Redlander::Node
82
82
 
83
83
  For query options and available query languages refer to `Model#query` documentation.
84
84
 
85
+ ### Localized string literals
86
+
87
+ Localized string literals are instantiated as LocalizedString objects.
88
+ Refer to the documentation and README file in `xml_schema` gem for details
89
+ on LocalizedString.
90
+
91
+ $ m.statments.first(:object => "bonjour".with_lang(:fr))
92
+
93
+ will return a first statement matching "bonjour@fr" literal as the object.
94
+
85
95
 
86
96
  ## Parsing Input
87
97
 
@@ -173,6 +183,11 @@ yields proper results in the block.
173
183
  Update your `redland` library to 1.0.15 or newer to fix this.
174
184
 
175
185
 
186
+ SPARQL DESCRIBE is not implemented in librdf.
187
+
188
+ > See [0000135](http://bugs.librdf.org/mantis/view.php?id=135) for a temporal workaround.
189
+
190
+
176
191
  # Authors and Contributors
177
192
 
178
193
  [Slava Kravchenko](https://github.com/cordawyn)
@@ -62,6 +62,7 @@ module Redland
62
62
  attach_function :librdf_node_to_string, [:pointer], :string
63
63
  attach_function :librdf_node_get_uri, [:pointer], :pointer
64
64
  attach_function :librdf_node_get_blank_identifier, [:pointer], :string
65
+ attach_function :librdf_node_get_literal_value_language, [:pointer], :string
65
66
 
66
67
  # Stream
67
68
  attach_function :librdf_free_stream, [:pointer], :void
@@ -31,9 +31,11 @@ module Redlander
31
31
  when URI
32
32
  Redland.librdf_new_node_from_uri_string(Redlander.rdf_world, arg.to_s)
33
33
  else
34
- value = arg.respond_to?(:xmlschema) ? arg.xmlschema : arg.to_s
35
34
  @datatype = XmlSchema.datatype_of(arg)
36
- Redland.librdf_new_node_from_typed_literal(Redlander.rdf_world, value, nil, Uri.new(@datatype).rdf_uri)
35
+ value = arg.respond_to?(:xmlschema) ? arg.xmlschema : arg.to_s
36
+ lang = arg.respond_to?(:lang) ? arg.lang.to_s : nil
37
+ dt = lang ? nil : Uri.new(@datatype).rdf_uri
38
+ Redland.librdf_new_node_from_typed_literal(Redlander.rdf_world, value, lang, dt)
37
39
  end
38
40
  raise RedlandError, "Failed to create a new node" if @rdf_node.null?
39
41
  ObjectSpace.define_finalizer(self, proc { Redland.librdf_free_node(@rdf_node) })
@@ -109,10 +111,16 @@ module Redlander
109
111
  Redland.librdf_node_get_blank_identifier(@rdf_node).force_encoding("UTF-8")
110
112
  else
111
113
  v = Redland.librdf_node_get_literal_value(@rdf_node).force_encoding("UTF-8")
114
+ v << "@#{lang}" if lang
112
115
  XmlSchema.instantiate(v, @datatype)
113
116
  end
114
117
  end
115
118
 
119
+ def lang
120
+ lng = Redland.librdf_node_get_literal_value_language(@rdf_node)
121
+ lng ? lng.to_sym : nil
122
+ end
123
+
116
124
 
117
125
  private
118
126
 
@@ -1,4 +1,4 @@
1
1
  module Redlander
2
2
  # Redlander version number
3
- VERSION = "0.5.3"
3
+ VERSION = "0.6.0"
4
4
  end
@@ -12,13 +12,13 @@ Gem::Specification.new do |gem|
12
12
  Redlander is Ruby bindings to Redland library (see http://librdf.org) written in C, which is used to manipulate RDF graphs. This is an alternative implementation of Ruby bindings (as opposed to the official bindings), aiming to be more intuitive, lightweight, high-performing and as bug-free as possible.
13
13
  HERE
14
14
 
15
- gem.files = `git ls-files`.split($\)
15
+ gem.files = `git ls-files`.split($\) - ["Gemfile.lock"]
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  # gem.add_dependency("librdf0", "~> 1.0.15")
21
- gem.add_dependency("xml_schema", "~> 0.1.3")
21
+ gem.add_dependency("xml_schema", "~> 0.2.0")
22
22
  gem.add_dependency("ffi", "~> 1.3")
23
23
  gem.add_development_dependency("rspec", "~> 2")
24
24
 
@@ -92,6 +92,14 @@ describe Node do
92
92
  node.datatype.should eql URI("http://www.w3.org/2001/XMLSchema#dateTime")
93
93
  end
94
94
 
95
+ it "should be created from a localized string" do
96
+ node = Node.new(LocalizedString.new("bonjour", :fr))
97
+ node.should be_literal
98
+ node.value.should eql "bonjour"
99
+ node.value.lang.should eql :fr
100
+ node.lang.should eql :fr
101
+ end
102
+
95
103
  it "should have proper string representation" do
96
104
  node = Node.new("Bye-bye, cruel world...")
97
105
  node.to_s.should eql('"Bye-bye, cruel world..."^^<http://www.w3.org/2001/XMLSchema#string>')
metadata CHANGED
@@ -1,70 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redlander
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.5.3
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Slava Kravchenko
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
11
+ date: 2013-03-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- type: :runtime
16
- version_requirements: !ruby/object:Gem::Requirement
14
+ name: xml_schema
15
+ requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
17
  - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: 0.1.3
21
- none: false
22
- name: xml_schema
19
+ version: 0.2.0
20
+ type: :runtime
23
21
  prerelease: false
24
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: !ruby/object:Gem::Requirement
25
23
  requirements:
26
24
  - - ~>
27
25
  - !ruby/object:Gem::Version
28
- version: 0.1.3
29
- none: false
26
+ version: 0.2.0
30
27
  - !ruby/object:Gem::Dependency
31
- type: :runtime
32
- version_requirements: !ruby/object:Gem::Requirement
28
+ name: ffi
29
+ requirement: !ruby/object:Gem::Requirement
33
30
  requirements:
34
31
  - - ~>
35
32
  - !ruby/object:Gem::Version
36
33
  version: '1.3'
37
- none: false
38
- name: ffi
34
+ type: :runtime
39
35
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
41
37
  requirements:
42
38
  - - ~>
43
39
  - !ruby/object:Gem::Version
44
40
  version: '1.3'
45
- none: false
46
41
  - !ruby/object:Gem::Dependency
47
- type: :development
48
- version_requirements: !ruby/object:Gem::Requirement
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
45
  - - ~>
51
46
  - !ruby/object:Gem::Version
52
47
  version: '2'
53
- none: false
54
- name: rspec
48
+ type: :development
55
49
  prerelease: false
56
- requirement: !ruby/object:Gem::Requirement
50
+ version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - ~>
59
53
  - !ruby/object:Gem::Version
60
54
  version: '2'
61
- none: false
62
- description: ! 'Redlander is Ruby bindings to Redland library (see http://librdf.org)
63
- written in C, which is used to manipulate RDF graphs. This is an alternative implementation
64
- of Ruby bindings (as opposed to the official bindings), aiming to be more intuitive,
65
- lightweight, high-performing and as bug-free as possible.
66
-
67
- '
55
+ description: |
56
+ Redlander is Ruby bindings to Redland library (see http://librdf.org) written in C, which is used to manipulate RDF graphs. This is an alternative implementation of Ruby bindings (as opposed to the official bindings), aiming to be more intuitive, lightweight, high-performing and as bug-free as possible.
68
57
  email:
69
58
  - slava.kravchenko@gmail.com
70
59
  executables: []
@@ -76,7 +65,6 @@ files:
76
65
  - .gitignore
77
66
  - ChangeLog
78
67
  - Gemfile
79
- - Gemfile.lock
80
68
  - LICENSE
81
69
  - README.md
82
70
  - Rakefile
@@ -105,33 +93,26 @@ files:
105
93
  homepage: https://github.com/cordawyn/redlander
106
94
  licenses:
107
95
  - The MIT License (MIT)
96
+ metadata: {}
108
97
  post_install_message:
109
98
  rdoc_options: []
110
99
  require_paths:
111
100
  - lib
112
101
  required_ruby_version: !ruby/object:Gem::Requirement
113
102
  requirements:
114
- - - ! '>='
103
+ - - '>='
115
104
  - !ruby/object:Gem::Version
116
- segments:
117
- - 0
118
- hash: 202030683622946567
119
105
  version: '0'
120
- none: false
121
106
  required_rubygems_version: !ruby/object:Gem::Requirement
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
- segments:
126
- - 0
127
- hash: 202030683622946567
128
110
  version: '0'
129
- none: false
130
111
  requirements: []
131
112
  rubyforge_project:
132
- rubygems_version: 1.8.24
113
+ rubygems_version: 2.0.0.rc.2
133
114
  signing_key:
134
- specification_version: 3
115
+ specification_version: 4
135
116
  summary: Advanced Ruby bindings for Redland runtime library (librdf).
136
117
  test_files:
137
118
  - spec/fixtures/doap.nt
@@ -1,30 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- redlander (0.5.3)
5
- ffi (~> 1.3)
6
- xml_schema (~> 0.1.3)
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- diff-lcs (1.1.3)
12
- ffi (1.3.1)
13
- rake (10.0.3)
14
- rspec (2.12.0)
15
- rspec-core (~> 2.12.0)
16
- rspec-expectations (~> 2.12.0)
17
- rspec-mocks (~> 2.12.0)
18
- rspec-core (2.12.2)
19
- rspec-expectations (2.12.1)
20
- diff-lcs (~> 1.1.3)
21
- rspec-mocks (2.12.1)
22
- xml_schema (0.1.3)
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- rake
29
- redlander!
30
- rspec (~> 2)