Skip to content

Commit

Permalink
Finish 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 30, 2021
2 parents 6b51d57 + 9ae6574 commit 492d6b7
Show file tree
Hide file tree
Showing 57 changed files with 185 additions and 24,199 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: U92RjLkZjzwi3VDahukmbTXemdvLS1oEs
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow runs continuous CI across different versions of ruby on all branches and pull requests to develop.

name: CI
on:
push:
branches: [ '**' ]
pull_request:
branches: [ develop ]
workflow_dispatch:

jobs:
tests:
name: Ruby ${{ matrix.ruby }}
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
runs-on: ubuntu-latest
env:
CI: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.6
- 2.7
- 3.0
- 3.1
- ruby-head
- jruby
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ Gemfile.lock
*.sw?
benchmark/

.storage
.storage
coverage
test-output
report
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@
- Ships with a limited server "Lamprey"
- Note: 0.1.0 was a gem containing only an `RDF::Vocabulary`, this
has been moved to `rdf-vocab`

0.2.1
------
- Deprecates Ruby < 2.6, supports Ruby 3.
- Updated dependencies.
8 changes: 4 additions & 4 deletions CONSTRAINED_BY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This file documents constraints imposed by `RDF::LDP`, `Rack:LDP` middleware, an
RDF Types
---------

The `RDF::LDP` core does not set types for resources. Complying with [LDP 4.3.1.2](http://www.w3.org/TR/ldp/#h-ldprs-gen-atleast1rdftype) is left to the client (or the server implementer). Interaction models are expressed as Link headers, and the client may infer rdf:types in accordance with the specification.
The `RDF::LDP` core does not set types for resources. Complying with [LDP 4.3.1.2](https://www.w3.org/TR/ldp/#h-ldprs-gen-atleast1rdftype) is left to the client (or the server implementer). Interaction models are expressed as Link headers, and the client may infer rdf:types in accordance with the specification.

Similarly, we do not enforce the recommendation of [LDP 5.2.1.3](http://www.w3.org/TR/ldp/#h-ldpc-nordfcontainertypes) for containers not to have type ` rdf:Bag`, `rdf:Seq` or `rdf:List`. This is left to the client (or server implementer) to manage.
Similarly, we do not enforce the recommendation of [LDP 5.2.1.3](https://www.w3.org/TR/ldp/#h-ldpc-nordfcontainertypes) for containers not to have type ` rdf:Bag`, `rdf:Seq` or `rdf:List`. This is left to the client (or server implementer) to manage.

POST/PUT Requests
------------------
Expand Down Expand Up @@ -47,7 +47,7 @@ For Indirect Contianers with an `ldp:insertedContentRelation` other than `ldp:Me
Named Graphs
-------------

Serializations supporting quads are allowed in POST and PUT requests. Graph names are ignored, and the file is treated as a single graph representing the resource. This behavior is seen as in compliance with [4.2.4.1](http://www.w3.org/TR/ldp/#h-ldpr-put-replaceall).
Serializations supporting quads are allowed in POST and PUT requests. Graph names are ignored, and the file is treated as a single graph representing the resource. This behavior is seen as in compliance with [4.2.4.1](https://www.w3.org/TR/ldp/#h-ldpr-put-replaceall).

HTTP PATCH
-----------
Expand All @@ -56,4 +56,4 @@ We currently support HTTP PATCH with the LDPatch and SPARQL Update formats. PATC

----

Linking to this document fulfills [Section 4.2.1.6](http://www.w3.org/TR/ldp#h-ldpr-gen-pubclireqs) of the LDP specification. Implementers of servers based on `RDF::LDP` and `Rack::LDP` are advised to create their own documents to clarify how these constraints effect their own services.
Linking to this document fulfills [Section 4.2.1.6](https://www.w3.org/TR/ldp#h-ldpr-gen-pubclireqs) of the LDP specification. Implementers of servers based on `RDF::LDP` and `Rack::LDP` are advised to create their own documents to clarify how these constraints effect their own services.
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Gregg Kellogg <gregg@greggkellogg.net>
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ end
group :test do
gem 'equivalent-xml'
gem 'rake'
gem 'simplecov', '~> 0.16', platforms: :mri
gem 'coveralls', '~> 0.8', '>= 0.8.23', platforms: :mri
end
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
RDF::LDP
========

[![Build Status](https://travis-ci.org/ruby-rdf/rdf-ldp.svg?branch=develop)](https://travis-ci.org/ruby-rdf/rdf-ldp)
[![Gem Version](https://badge.fury.io/rb/rdf-ldp.png)](https://badge.fury.io/rb/rdf-ldp)
[![Build Status](https://github.com/ruby-rdf/rdf-ldp/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-ldp/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-ldp/badge.svg)](https://coveralls.io/github/ruby-rdf/rdf-ldp)
[![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)

Server-side support for Linked Data Platform (LDP) with RDF.rb. To get started
with LDP, see the [LDP Primer](https://dvcs.w3.org/hg/ldpwg/raw-file/default/ldp-primer/ldp-primer.html).
Expand Down Expand Up @@ -89,7 +91,7 @@ app = proc do |env|
# The `Rack::LDP` middleware marhsalls the request to the resource, builds the response,
# and handles conneg for RDF serializations (when the body is an `RDF::LDP::RDFSource`).
#
# @see http://www.rubydoc.info/github/rack/rack/master/file/SPEC#The_Response
# @see https://www.rubydoc.info/github/rack/rack/master/file/SPEC#The_Response
[200, {}, RDF::LDP::Resource.find(RDF::URI(env['REQUEST_URI']), repository)]
end
Expand Down Expand Up @@ -148,10 +150,33 @@ gem to run the suite and generate the tests.
RDF.rb Compatibility
--------------------------

As of version 2.0, this software depends on RDF.rb 3.1 or greater.
As of version 2.1, this software depends on RDF.rb 3.2 or greater.

## Contributing

License
========
This repository uses [Git Flow](https://github.com/nvie/gitflow) to mange development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.

* Do your best to adhere to the existing coding conventions and idioms.
* Don't use hard tabs, and don't leave trailing whitespace on any line.
Before committing, run `git diff --check` to make sure of this.
* Do document every method you add using [YARD][] annotations. Read the
[tutorial][YARD-GS] or just look at the existing code for examples.
* Don't touch the `.gemspec` or `VERSION` files. If you need to change them,
do so on your private branch only.
* Do feel free to add yourself to the `CREDITS` file and the
corresponding list in the the `README`. Alphabetical order applies.
* Don't touch the `AUTHORS` file. If your contributions are significant
enough, be assured we will eventually add you in there.
* Do note that in order for us to merge any non-trivial changes (as a rule
of thumb, additions larger than about 15 lines of code), we need an
explicit [public domain dedication][PDD] on record from you,
which you will be asked to agree to on the first commit to a repo within the organization.
Note that the agreement applies to all repos in the [Ruby RDF](https://github.com/ruby-rdf/) organization.

## License

This software is released under a public domain waiver (Unlicense).

[YARD]: https://yardoc.org/
[YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
[PDD]: https://unlicense.org/#unlicensing-contributions
2 changes: 1 addition & 1 deletion UNLICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>
For more information, please refer to <https://unlicense.org/>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.1.0
26 changes: 13 additions & 13 deletions etc/doap.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

<rdf-ldp> a doap:Project ;
doap:name "RDF::LDP" ;
doap:homepage <http://rubygems.org/gems/rdf-ldp> ;
doap:license <http://creativecommons.org/licenses/publicdomain/> ;
doap:homepage <https://github.com/ruby-rdf/rdf-ldp> ;
doap:license <https://unlicense.org/1.0/> ;
doap:shortdesc "A suite of LDP software and middleware for RDF.rb" ;
doap:description "Implements a Linked Data Platform domain model, Rack middleware for server implementers, and a simple Sinatra-based server for RDF.rb" ;
doap:created "2015-07-17"^^xsd:date ;
doap:platform "Ruby" ;
doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
<http://dbpedia.org/resource/Linked_Data_Platform>,
<http://dbpedia.org/resource/Ruby_(programming_language)> ;
doap:implements <http://www.w3.org/TR/ldp/> ;
doap:bug-database <http://github.com/ruby-rdf/rdf-ldp/issues> ;
doap:programming-language "Ruby" ;
doap:category <https://dbpedia.org/resource/Resource_Description_Framework>,
<https://dbpedia.org/resource/Linked_Data_Platform>,
<https://dbpedia.org/resource/Ruby_(programming_language)> ;
doap:implements <https://www.w3.org/TR/ldp/> ;
doap:bug-database <https://github.com/ruby-rdf/rdf-ldp/issues> ;
doap:vendor <https://github.com/orgs/ruby-rdf/teams/ldp#team> ;
doap:developer <https://github.com/no-reply#self> ;
doap:maintainer <https://github.com/no-reply#self> ;
Expand All @@ -28,16 +28,16 @@

<lamprey> a doap:Project ;
doap:name "Lamprey" ;
doap:homepage <http://rubygems.org/gems/rdf-ldp> ;
doap:license <http://creativecommons.org/licenses/publicdomain/> ;
doap:homepage <https://rubygems.org/gems/rdf-ldp> ;
doap:license <https://unlicense.org/1.0/> ;
doap:shortdesc "A Ruby LDP server based on RDF.rb, RDF::LDP, and Sinatra." ;
doap:created "2015-07-17"^^xsd:date ;
doap:platform "Ruby" ;
doap:programming-language "Ruby" ;
doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
<http://dbpedia.org/resource/Linked_Data_Platform>,
<http://dbpedia.org/resource/Ruby_(programming_language)> ;
doap:implements <http://www.w3.org/TR/ldp/> ;
doap:bug-database <http://github.com/ruby-rdf/rdf-ldp/issues> ;
doap:implements <https://www.w3.org/TR/ldp/> ;
doap:bug-database <https://github.com/ruby-rdf/rdf-ldp/issues> ;
doap:vendor <https://github.com/orgs/ruby-rdf/teams/ldp#team> ;
doap:developer <https://github.com/no-reply#self> ;
doap:maintainer <https://github.com/no-reply#self> ;
Expand Down
6 changes: 3 additions & 3 deletions lib/rack/ldp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module Rack
# # ...
# end
#
# @see http://www.w3.org/TR/ldp/ the LDP specification
# @see https://www.w3.org/TR/ldp/ the LDP specification
module LDP
##
# Catches and handles RequestErrors thrown by RDF::LDP
Expand Down Expand Up @@ -108,10 +108,10 @@ def call(env)
end

##
# Specializes {Rack::LinkedData::ContentNegotiation}, making the default
# Specializes `Rack::LinkedData::ContentNegotiation`, making the default
# return type 'text/turtle'.
#
# @see Rack::LinkedData::ContentNegotiation}, making
# @see Rack::LinkedData::ContentNegotiation, making
class ContentNegotiation < Rack::LinkedData::ContentNegotiation
DEFAULT_PREFIXES =
Hash[*::RDF::Vocabulary.map { |v| [v.__prefix__, v.to_uri] }.flatten]
Expand Down
2 changes: 1 addition & 1 deletion lib/rdf/ldp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module RDF
# Rack servers.
#
# @see RDF::LDP::Resource
# @see http://www.w3.org/TR/ldp/ for the Linked Data platform specification
# @see https://www.w3.org/TR/ldp/ for the Linked Data platform specification
module LDP
InteractionModel.register(RDF::LDP::RDFSource, default: true)
InteractionModel.register(RDF::LDP::Container,
Expand Down
30 changes: 17 additions & 13 deletions lib/rdf/ldp/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ module RDF::LDP
# Containers will throw errors when attempting to edit them in conflict with
# LDP's restrictions on changing containment triples.
#
# @see http://www.w3.org/TR/ldp/#dfn-linked-data-platform-container definition
# @see https://www.w3.org/TR/ldp/#dfn-linked-data-platform-container definition
# of LDP Container
class Container < RDFSource
##
# @return [RDF::URI] uri with lexical representation
# 'http://www.w3.org/ns/ldp#Container'
# 'https://www.w3.org/ns/ldp#Container'
def self.to_uri
RDF::Vocab::LDP.Container
end
Expand Down Expand Up @@ -69,9 +69,10 @@ def update(input, content_type, &block)
# containment triple is completed when the transaction closes; otherwise it
# is handled atomically.
#
# @param [RDF::Term] a new member for this container
# @param transaction [RDF::Transaction] an active transaction as context for
# the addition
# @param [RDF::Term] resource
# a new member for this container
# @param transaction [RDF::Transaction] transaction
# an active transaction as context for the addition
# @return [Container] self
def add(resource, transaction = nil)
add_containment_triple(resource.to_uri, transaction)
Expand All @@ -85,9 +86,10 @@ def add(resource, transaction = nil)
# containment triple is completed when the transaction closes; otherwise it
# is handled atomically.
#
# @param [RDF::Term] a new member for this container
# @param transaction [RDF::Transaction] an active transaction as context for
# the removal
# @param [RDF::Term] resource
# a new member for this container
# @param transaction [RDF::Transaction] transaction
# an active transaction as context for the removal
# @return [Container] self
def remove(resource, transaction = nil)
remove_containment_triple(resource.to_uri, transaction)
Expand Down Expand Up @@ -140,9 +142,11 @@ def remove_containment_triple(resource, transaction = nil)
end

##
# @param [RDF::Term] a member to be represented in the containment triple
# @param [RDF::Term] resource
# a member to be represented in the containment triple
#
# @return [RDF::URI] the containment triple, with a graph_name pointing
# @return [RDF::URI]
# the containment triple, with a graph_name pointing
# to `#graph`
def make_containment_triple(resource)
RDF::Statement(subject_uri, CONTAINS_URI, resource,
Expand Down Expand Up @@ -200,8 +204,8 @@ def post(_status, headers, env)
def validate_triples!(transaction)
existing_triples = containment_triples.to_a

tx_containment = transaction.query(subject: subject_uri,
predicate: CONTAINS_URI)
tx_containment = transaction.query({subject: subject_uri,
predicate: CONTAINS_URI})

tx_containment.each do |statement|
unless existing_triples.include?(statement)
Expand All @@ -222,7 +226,7 @@ def validate_triples!(transaction)
# supports Patch.
def validate_statements!(statements)
existing_triples = containment_triples.to_a
statements.query(subject: subject_uri, predicate: CONTAINS_URI) do |st|
statements.query({subject: subject_uri, predicate: CONTAINS_URI}) do |st|
existing_triples.delete(st) do
raise(Conflict, 'Attempted to write unacceptable LDP ' \
"containment-triple: #{st}")
Expand Down
8 changes: 4 additions & 4 deletions lib/rdf/ldp/direct_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module RDF::LDP
# If more than one of either is given, all `#add/#remove` (POST/DELETE)
# requests will fail.
#
# @see http://www.w3.org/TR/ldp/#dfn-linked-data-platform-direct-container
# @see https://www.w3.org/TR/ldp/#dfn-linked-data-platform-direct-container
# definition of LDP Direct Container
class DirectContainer < Container
MEMBER_URI = RDF::Vocab::LDP.member.freeze
Expand Down Expand Up @@ -98,7 +98,7 @@ def remove(resource, transaction = nil)
# @raise [RDF::LDP::NotAcceptable] if multiple membership constant uris
# exist
#
# @see http://www.w3.org/TR/ldp/#dfn-membership-triples
# @see https://www.w3.org/TR/ldp/#dfn-membership-triples
def membership_constant_uri
statements = membership_resource_statements
return statements.first.object if statements.count == 1
Expand All @@ -115,7 +115,7 @@ def membership_constant_uri
#
# @raise [RDF::LDP::NotAcceptable] if multiple membership predicates exist
#
# @see http://www.w3.org/TR/ldp/#dfn-membership-predicate
# @see https://www.w3.org/TR/ldp/#dfn-membership-predicate
def membership_predicate
statements = member_relation_statements
return statements.first.object if statements.count == 1
Expand All @@ -130,7 +130,7 @@ def membership_predicate
# @return [RDF::URI] the membership triple representing membership of the
# `resource` parameter in this container
#
# @see http://www.w3.org/TR/ldp/#dfn-membership-triples
# @see https://www.w3.org/TR/ldp/#dfn-membership-triples
def make_membership_triple(resource)
predicate = membership_predicate
return RDF::Statement(membership_constant_uri, predicate, resource) if
Expand Down
6 changes: 3 additions & 3 deletions lib/rdf/ldp/indirect_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module RDF::LDP
# Acceptable`. LDP-NR's cannot be added since indirect membership is not well
# defined for them, per _LDP 5.5.1.2_.
#
# @see http://www.w3.org/TR/ldp/#h-ldpic-indirectmbr for an explanation if
# @see https://www.w3.org/TR/ldp/#h-ldpic-indirectmbr for an explanation if
# indirect membership and limitiations surrounding LDP-NRs.
# @see http://www.w3.org/TR/ldp/#dfn-linked-data-platform-indirect-container
# @see https://www.w3.org/TR/ldp/#dfn-linked-data-platform-indirect-container
# definition of LDP Indirect Container
class IndirectContainer < DirectContainer
INSERTED_CONTENT_REL_URI = RDF::Vocab::LDP.insertedContentRelation.freeze
Expand Down Expand Up @@ -61,7 +61,7 @@ def create(input, content_type)
# @raise [RDF::LDP::NotAcceptable] if multiple inserted content relations
# exist.
#
# @see http://www.w3.org/TR/ldp/#dfn-membership-triples
# @see https://www.w3.org/TR/ldp/#dfn-membership-triples
def inserted_content_relation
statements = inserted_content_statements
return statements.first.object if statements.count == 1
Expand Down
Loading

0 comments on commit 492d6b7

Please sign in to comment.