active-triples 1.1.0 → 1.1.1
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 +5 -5
- data/.gitlab-ci.yml +47 -0
- data/CHANGES.md +5 -0
- data/Gemfile +8 -1
- data/README.md +8 -8
- data/active-triples.gemspec +1 -1
- data/lib/active_triples/properties.rb +8 -8
- data/lib/active_triples/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +8 -9
- data/spec/pragmatic_context_spec.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b0ff972e1b4c29224d95c3b805194625adb62bd2e0b2f8e6bc10dce62fb048d0
|
4
|
+
data.tar.gz: b53c8cc0662587141709428bd6bb4aa522ddd24387d1b10807202c23a1e66554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cb53a7845d93423d84bdac4fa82b6470f28867ee5cf8c4bc04f8ba5a3046cc3b6c6f34f8ef2a04aa211c880a7c55700e68cbfc3a73729382a5e4409933b4dd6
|
7
|
+
data.tar.gz: 279c0e2236bf9ad69aefc7e8e3e41e697431b8b103e548cc75b0985eeac1237e598f5fe89da71f9e4d86bad92bec84d4ab94b51c1a0798eb149021b0068d350f
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
.rspec:
|
2
|
+
script:
|
3
|
+
- bundle exec rspec
|
4
|
+
|
5
|
+
.jruby:
|
6
|
+
extends: .rspec
|
7
|
+
before_script:
|
8
|
+
- apk add git
|
9
|
+
- ruby -v
|
10
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
11
|
+
|
12
|
+
before_script:
|
13
|
+
- ruby -v
|
14
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
15
|
+
|
16
|
+
stages:
|
17
|
+
- test
|
18
|
+
|
19
|
+
ruby-2-4:
|
20
|
+
image: ruby:2.4
|
21
|
+
extends: .rspec
|
22
|
+
stage: test
|
23
|
+
|
24
|
+
ruby-2-5:
|
25
|
+
image: ruby:2.4
|
26
|
+
extends: .rspec
|
27
|
+
stage: test
|
28
|
+
|
29
|
+
ruby-2-6:
|
30
|
+
image: ruby:2.5
|
31
|
+
extends: .rspec
|
32
|
+
stage: test
|
33
|
+
|
34
|
+
ruby-2-7:
|
35
|
+
image: ruby:2.6
|
36
|
+
extends: .rspec
|
37
|
+
stage: test
|
38
|
+
|
39
|
+
ruby-latest:
|
40
|
+
image: ruby:latest
|
41
|
+
extends: .rspec
|
42
|
+
stage: test
|
43
|
+
|
44
|
+
jruby-9:
|
45
|
+
image: jruby:9-alpine
|
46
|
+
extends: .jruby
|
47
|
+
stage: test
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -2,5 +2,12 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'activesupport', '< 5.0.0' if RUBY_VERSION =~ /2\.1\..*/
|
6
5
|
gem 'pry-byebug' unless ENV["CI"]
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'rdf-spec', github: 'ruby-rdf/rdf-spec', branch: 'develop'
|
9
|
+
gem 'simplecov', require: false
|
10
|
+
end
|
11
|
+
|
12
|
+
Encoding.default_external = Encoding::UTF_8
|
13
|
+
Encoding.default_internal = Encoding::UTF_8
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Description
|
2
2
|
-----------
|
3
3
|
|
4
|
-
[](https://gitlab.com/no_reply/ActiveTriples/commits/develop)
|
5
|
+
[](https://gitlab.com/no_reply/ActiveTriples/commits/develop)
|
6
6
|
[](http://badge.fury.io/rb/active-triples)
|
7
7
|
|
8
8
|
An ActiveModel-like interface for RDF data. Models graphs as RDFSources with property/attribute configuration, accessors, and other methods to support Linked Data in a Ruby/Rails enviornment. See [RDF Concepts and Abstract Syntax](http://www.w3.org/TR/2014/REC-rdf11-concepts-20140225/#change-over-time) for an informal definition of an RDF Source.
|
@@ -27,9 +27,9 @@ require 'rdf/vocab'
|
|
27
27
|
|
28
28
|
class Thing
|
29
29
|
include ActiveTriples::RDFSource
|
30
|
-
|
30
|
+
|
31
31
|
configure type: RDF::OWL.Thing, base_uri: 'http://example.org/things#'
|
32
|
-
|
32
|
+
|
33
33
|
property :title, predicate: RDF::Vocab::DC.title
|
34
34
|
property :description, predicate: RDF::Vocab::DC.description
|
35
35
|
end
|
@@ -48,10 +48,10 @@ Thing.property :creator, predicate: RDF::Vocab::DC.creator, class_name: 'Person'
|
|
48
48
|
|
49
49
|
class Person
|
50
50
|
include ActiveTriples::RDFSource
|
51
|
-
|
51
|
+
|
52
52
|
configure type: RDF::Vocab::FOAF.Person,
|
53
53
|
base_uri: 'http://example.org/people#'
|
54
|
-
|
54
|
+
|
55
55
|
property :name, predicate: RDF::Vocab::FOAF.name
|
56
56
|
end
|
57
57
|
|
@@ -171,7 +171,7 @@ ActiveTriples::Repositories.add_repository :people, RDF::Repository.new
|
|
171
171
|
|
172
172
|
class Person
|
173
173
|
include ActiveTriples::RDFSource
|
174
|
-
|
174
|
+
|
175
175
|
configure type: RDF::Vocab::FOAF.Person,
|
176
176
|
base_uri: 'http://example.org/people#',
|
177
177
|
repository: :people
|
@@ -184,7 +184,7 @@ class Thing
|
|
184
184
|
configure type: RDF::OWL.Thing,
|
185
185
|
base_uri: 'http://example.org/things#',
|
186
186
|
repository: :default
|
187
|
-
|
187
|
+
|
188
188
|
property :title, predicate: RDF::Vocab::DC.title
|
189
189
|
property :description, predicate: RDF::Vocab::DC.description
|
190
190
|
property :creator, predicate: RDF::Vocab::DC.creator, class_name: 'Person'
|
data/active-triples.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = ActiveTriples::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Tom Johnson", "Trey Terrell"]
|
10
|
-
s.homepage = 'https://
|
10
|
+
s.homepage = 'https://gitlab.com/no_reply/ActiveTriples'
|
11
11
|
s.email = 'tom@curationexperts.com'
|
12
12
|
s.summary = %q{RDF graphs in ActiveModel wrappers.}
|
13
13
|
s.description = %q{ActiveTriples provides tools for modeling RDF as discrete resources.}
|
@@ -123,26 +123,26 @@ module ActiveTriples
|
|
123
123
|
# @param [Hash] opts for this property, must include a :predicate
|
124
124
|
# @yield [index] index sets solr behaviors for the property
|
125
125
|
#
|
126
|
-
# @return [Hash{String=>ActiveTriples::NodeConfig}] the full current
|
126
|
+
# @return [Hash{String=>ActiveTriples::NodeConfig}] the full current
|
127
127
|
# property configuration for the class
|
128
128
|
def property(name, opts={}, &block)
|
129
|
-
raise ArgumentError, "#{name} is a keyword and not an acceptable property name." if protected_property_name?
|
129
|
+
raise ArgumentError, "#{name} is a keyword and not an acceptable property name." if protected_property_name?(name.to_sym)
|
130
130
|
reflection = PropertyBuilder.build(self, name, opts, &block)
|
131
131
|
Reflection.add_reflection self, name, reflection
|
132
132
|
end
|
133
133
|
|
134
134
|
##
|
135
|
-
# Checks potential property names for conflicts with existing class
|
136
|
-
# instance methods. We avoid setting properties with these names to
|
135
|
+
# Checks potential property names for conflicts with existing class
|
136
|
+
# instance methods. We avoid setting properties with these names to
|
137
137
|
# prevent catastrophic method overwriting.
|
138
138
|
#
|
139
139
|
# @param [Symblol] name A potential property name.
|
140
|
-
# @return [Boolean] true if the given name matches an existing instance
|
140
|
+
# @return [Boolean] true if the given name matches an existing instance
|
141
141
|
# method which is not an ActiveTriples property.
|
142
142
|
def protected_property_name?(name)
|
143
|
-
|
144
|
-
|
145
|
-
|
143
|
+
return false if fields.include?(name)
|
144
|
+
return true if instance_methods.include?(name) || instance_methods.include?("#{name}=".to_sym)
|
145
|
+
false
|
146
146
|
end
|
147
147
|
|
148
148
|
##
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-triples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Johnson
|
8
8
|
- Trey Terrell
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
@@ -261,6 +261,7 @@ extra_rdoc_files:
|
|
261
261
|
files:
|
262
262
|
- ".coveralls.yml"
|
263
263
|
- ".gitignore"
|
264
|
+
- ".gitlab-ci.yml"
|
264
265
|
- ".travis.yml"
|
265
266
|
- AUTHORS
|
266
267
|
- CHANGES.md
|
@@ -328,17 +329,16 @@ files:
|
|
328
329
|
- spec/integration/dummies/dummy_resource_b.rb
|
329
330
|
- spec/integration/parent_persistence_spec.rb
|
330
331
|
- spec/integration/reciprocal_properties_spec.rb
|
331
|
-
- spec/pragmatic_context_spec.rb
|
332
332
|
- spec/spec_helper.rb
|
333
333
|
- spec/support/active_model_lint.rb
|
334
334
|
- spec/support/dummies/basic_persistable.rb
|
335
335
|
- spec/support/matchers.rb
|
336
336
|
- spec/support/shared_examples/persistence_strategy.rb
|
337
|
-
homepage: https://
|
337
|
+
homepage: https://gitlab.com/no_reply/ActiveTriples
|
338
338
|
licenses:
|
339
339
|
- Apache-2.0
|
340
340
|
metadata: {}
|
341
|
-
post_install_message:
|
341
|
+
post_install_message:
|
342
342
|
rdoc_options: []
|
343
343
|
require_paths:
|
344
344
|
- lib
|
@@ -353,9 +353,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
353
353
|
- !ruby/object:Gem::Version
|
354
354
|
version: '0'
|
355
355
|
requirements: []
|
356
|
-
|
357
|
-
|
358
|
-
signing_key:
|
356
|
+
rubygems_version: 3.1.2
|
357
|
+
signing_key:
|
359
358
|
specification_version: 4
|
360
359
|
summary: RDF graphs in ActiveModel wrappers.
|
361
360
|
test_files: []
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'pragmatic_context'
|
4
|
-
|
5
|
-
describe 'PragmaticContext integration' do
|
6
|
-
before do
|
7
|
-
class DummyLicense
|
8
|
-
include ActiveTriples::RDFSource
|
9
|
-
include PragmaticContext::Contextualizable
|
10
|
-
property :title, :predicate => RDF::Vocab::DC.title
|
11
|
-
|
12
|
-
contextualize :title, :as => RDF::Vocab::DC.title.to_s
|
13
|
-
end
|
14
|
-
|
15
|
-
class DummyResource
|
16
|
-
include ActiveTriples::RDFSource
|
17
|
-
include PragmaticContext::Contextualizable
|
18
|
-
|
19
|
-
configure :type => RDF::URI('http://example.org/SomeClass')
|
20
|
-
property :license, :predicate => RDF::Vocab::DC.license,
|
21
|
-
:class_name => DummyLicense
|
22
|
-
property :title, :predicate => RDF::Vocab::DC.title
|
23
|
-
|
24
|
-
contextualize :title, :as => RDF::Vocab::DC.title.to_s
|
25
|
-
contextualize :license, :as => RDF::Vocab::DC.license.to_s
|
26
|
-
end
|
27
|
-
|
28
|
-
license.title = 'cc'
|
29
|
-
subject.title = 'my resource'
|
30
|
-
subject.license = license
|
31
|
-
subject.license << RDF::Literal('Creative Commons')
|
32
|
-
end
|
33
|
-
|
34
|
-
after do
|
35
|
-
Object.send(:remove_const, "DummyResource")
|
36
|
-
Object.send(:remove_const, "DummyLicense")
|
37
|
-
end
|
38
|
-
|
39
|
-
subject { DummyResource.new('http://example.org/test') }
|
40
|
-
let(:license) { DummyLicense.new }
|
41
|
-
|
42
|
-
xit 'should output a valid jsonld representation of itself' do
|
43
|
-
g = RDF::Graph.new << JSON::LD::API.toRdf(subject.as_jsonld)
|
44
|
-
expect(subject == g).to be true
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should have contexts' do
|
48
|
-
expect(subject.as_jsonld['@context'].keys).to contain_exactly('license', 'title')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should use context with dump' do
|
52
|
-
context = JSON.parse(subject.dump :jsonld)['@context']
|
53
|
-
subject.class.properties.keys.each do |prop|
|
54
|
-
expect(context).to include prop
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|