Skip to content

Commit

Permalink
Finish 3.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Feb 2, 2021
2 parents 65dd9c0 + 24ef570 commit c8b2fe7
Show file tree
Hide file tree
Showing 41 changed files with 1,514 additions and 154 deletions.
1 change: 1 addition & 0 deletions .coveralls.yml
@@ -0,0 +1 @@
repo_token: EUv9wY2KnN7lYmiGWUFhEKH73Ndwtok1A
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -31,7 +31,8 @@ jobs:
- 2.5
- 2.6
- 2.7
# - ruby-head # net-http-persistent
- 3.0
- ruby-head
- jruby
steps:
- name: Clone repository
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,5 +1,5 @@
source "https://rubygems.org"
gem "nokogiri", '~> 1.8'
gem "nokogiri", '~> 1.10'
gem "nokogumbo", platforms: :mri

gemspec
Expand Down
19 changes: 16 additions & 3 deletions README.md
Expand Up @@ -4,7 +4,7 @@

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

## Features
Expand All @@ -17,7 +17,7 @@ JSON::LD can now be used to create a _context_ from an RDFS/OWL definition, and
* If available, uses [Nokogiri][] and/or [Nokogumbo][] for parsing HTML, falls back to REXML otherwise.
* Provisional support for [JSON-LD*][JSON-LD*].

[Implementation Report](file.earl.html)
[Implementation Report](https://ruby-rdf.github.io/json-ld/etc/earl.html)

Install with `gem install json-ld`

Expand All @@ -39,7 +39,7 @@ The [MultiJson](https://rubygems.org/gems/multi_json) gem is used for parsing JS

### JSON-LD* (RDFStar)

The {JSON::LD::API.toRdf} and {JSON::LD::API.fromRdf} API methods, along with the {JSON::LD::Reader} and {JSON::LD::Writer}, include provisional support for [JSON-LD*][JSON-LD*].
The {JSON::LD::API.expand}, {JSON::LD::API.compact}, {JSON::LD::API.toRdf}, and {JSON::LD::API.fromRdf} API methods, along with the {JSON::LD::Reader} and {JSON::LD::Writer}, include provisional support for [JSON-LD*][JSON-LD*].

Internally, an `RDF::Statement` is treated as another resource, along with `RDF::URI` and `RDF::Node`, which allows an `RDF::Statement` to have a `#subject` or `#object` which is also an `RDF::Statement`.

Expand All @@ -55,6 +55,19 @@ In JSON-LD, with the `rdfstar` option set, the value of `@id`, in addition to an
"ex:certainty": 0.9
}

Additionally, the `@annotation` property (or alias) may be used on a node object or value object to annotate the statement for which the associated node is the object of a triple.

{
"@context": {"foaf": "http://xmlns.com/foaf/0.1/"},
"@id": "bob",
"foaf:age" 23,
"@annotation": {
"ex:certainty": 0.9
}
}

In the first case, the embedded node is not asserted, and only appears as the subject of a triple. In the second case, the triple is asserted and used as the subject in another statement which annotates it.

**Note: This feature is subject to change or elimination as the standards process progresses.**

#### Serializing a Graph containing embedded statements
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.1.7
3.1.8
6 changes: 3 additions & 3 deletions bin/jsonld
Expand Up @@ -24,7 +24,7 @@ def run(input, options, parser_options)

start = Time.new
if options[:expand]
parser_options = parser_options.merge(expandContext: parser_options.delete(:context)) if parser_options.has_key?(:context)
parser_options = parser_options.merge(expandContext: parser_options.delete(:context)) if parser_options.key?(:context)
input = JSON::LD::API.fromRdf(reader) if reader
output = JSON::LD::API.expand(input, parser_options)
secs = Time.new - start
Expand All @@ -49,7 +49,7 @@ def run(input, options, parser_options)
options[:output].puts output.to_json(JSON::LD::JSON_STATE)
STDERR.puts "Framed in #{secs} seconds." unless options[:quiet]
else
parser_options = parser_options.merge(expandContext: parser_options.delete(:context)) if parser_options.has_key?(:context)
parser_options = parser_options.merge(expandContext: parser_options.delete(:context)) if parser_options.key?(:context)
parser_options[:standard_prefixes] = true
reader ||= JSON::LD::Reader.new(input, parser_options)
num = 0
Expand Down Expand Up @@ -181,7 +181,7 @@ opts.each do |opt, arg|
end

# Hack
if !(options.keys & [:expand, :compact, :flatten, :frame]).empty? &&
if !(options.keys & %i{expand compact flatten frame}).empty? &&
(parser_options[:stream] || options[:output_format] != :jsonld)
STDERR.puts "Incompatible options"
exit(1)
Expand Down
6 changes: 3 additions & 3 deletions etc/doap.ttl
Expand Up @@ -8,11 +8,13 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<> a doap:Project;
doap:name "JSON::LD"^^xsd:string;
doap:shortdesc "JSON-LD support for Ruby."@en;
doap:description "JSON::LD parses and serializes JSON-LD into RDF and implements expansion, compaction and framing API interfaces for the Ruby RDF.rb library suite."@en;
dc:creator <https://greggkellogg.net/foaf#me>;
doap:blog <https://greggkellogg.net/>;
doap:bug-database <https://github.com/ruby-rdf/json-ld/issues>;
doap:created "2011-05-07"^^xsd:date;
doap:description "RDF.rb extension for parsing/serializing JSON-LD data."@en;
doap:developer <https://greggkellogg.net/foaf#me>;
doap:documenter <https://greggkellogg.net/foaf#me>;
doap:homepage <https://github.com/ruby-rdf/json-ld/>;
Expand All @@ -21,9 +23,7 @@
<https://www.w3.org/TR/json-ld11-framing/>;
doap:license <https://unlicense.org/1.0/>;
doap:maintainer <https://greggkellogg.net/foaf#me>;
doap:name "JSON::LD"^^xsd:string;
doap:programming-language "Ruby";
doap:shortdesc "JSON-LD support for RDF.rb."@en;
foaf:maker <https://greggkellogg.net/foaf#me> .

<https://greggkellogg.net/foaf#me> a foaf:Person;
Expand Down
2 changes: 1 addition & 1 deletion etc/template.haml
Expand Up @@ -102,7 +102,7 @@
%dd{rel: "doap:developer"}
- subject['developer'].each do |dev|
%div{resource: dev['@id'], typeof: Array(dev['@type']).join(" ")}
- if dev.has_key?('@id')
- if dev.key?('@id')
%a{href: dev['@id']}
%span{property: "foaf:name"}<
~ CGI.escapeHTML dev['foaf:name'].to_s
Expand Down
44 changes: 44 additions & 0 deletions example-files/shacl-severity-002-frame.jsonld
@@ -0,0 +1,44 @@
{
"@context": {
"id": "@id",
"type": {"@id": "@type", "@container": "@set"},
"@vocab": "http://www.w3.org/ns/shacl#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"shacl": "http://www.w3.org/ns/shacl#",
"sh": "http://www.w3.org/ns/shacl#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"and": {"@type": "@id", "@container": "@list"},
"annotationProperty": {"@type": "@id"},
"class": {"@type": "@id"},
"comment": "http://www.w3.org/2000/01/rdf-schema#comment",
"condition": {"@type": "@id"},
"datatype": {"@type": "@vocab"},
"declare": {"@type": "@id"},
"disjoint": {"@type": "@id"},
"disjoint": {"@type": "@id"},
"entailment": {"@type": "@id"},
"equals": {"@type": "@id"},
"ignoredProperties": {"@type": "@id", "@container": "@list"},
"in": {"@type": "@none", "@container": "@list"},
"inversePath": {"@type": "@id"},
"label": "http://www.w3.org/2000/01/rdf-schema#label",
"languageIn": {"@container": "@list"},
"lessThan": {"@type": "@id"},
"lessThanOrEquals": {"@type": "@id"},
"nodeKind": {"@type": "@vocab"},
"or": {"@type": "@id", "@container": "@list"},
"path": {"@type": "@none"},
"property": {"@type": "@id"},
"severity": {"@type": "@vocab"},
"targetClass": {"@type": "@id"},
"targetNode": {"@type": "@none"},
"xone": {"@type": "@id", "@container": "@list"}
},
"@requireAll": false,
"@type": ["NodeShape", "PropertyShape"],
"property": {},
"targetClass": {},
"targetNode": {},
"targetObjectsOf": {},
"targetSubjectsOf": {}
}
191 changes: 191 additions & 0 deletions example-files/shacl-severity-002.jsonld
@@ -0,0 +1,191 @@
[
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#InvalidResource1",
"http://datashapes.org/sh/tests/core/misc/severity-002.test#property": [
{
"@value": true
}
]
},
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#TestShape1",
"http://www.w3.org/ns/shacl#nodeKind": [
{
"@id": "http://www.w3.org/ns/shacl#BlankNode"
}
],
"http://www.w3.org/ns/shacl#property": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#TestShape2"
}
],
"http://www.w3.org/ns/shacl#severity": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#MySeverity"
}
],
"http://www.w3.org/ns/shacl#targetNode": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#InvalidResource1"
}
]
},
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#TestShape2",
"http://www.w3.org/ns/shacl#path": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#property"
}
],
"http://www.w3.org/ns/shacl#datatype": [
{
"@id": "http://www.w3.org/2001/XMLSchema#integer"
}
],
"http://www.w3.org/ns/shacl#severity": [
{
"@id": "http://www.w3.org/ns/shacl#Info"
}
]
},
{
"@id": "urn:x-shacl-test:/core/misc/severity-002.ttl",
"@type": [
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#Manifest"
],
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#entries": [
{
"@list": [
{
"@id": "urn:x-shacl-test:/core/misc/severity-002"
}
]
}
]
},
{
"@id": "urn:x-shacl-test:/core/misc/severity-002",
"@type": [
"http://www.w3.org/ns/shacl-test#Validate"
],
"http://www.w3.org/2000/01/rdf-schema#label": [
{
"@value": "Test of sh:severity 002"
}
],
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#action": [
{
"@id": "_:g451300"
}
],
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#result": [
{
"@id": "_:g451320"
}
],
"http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#status": [
{
"@id": "http://www.w3.org/ns/shacl-test#approved"
}
]
},
{
"@id": "_:g451300",
"http://www.w3.org/ns/shacl-test#dataGraph": [
{
"@id": "urn:x-shacl-test:/core/misc/severity-002.ttl"
}
],
"http://www.w3.org/ns/shacl-test#shapesGraph": [
{
"@id": "urn:x-shacl-test:/core/misc/severity-002.ttl"
}
]
},
{
"@id": "_:g451320",
"@type": [
"http://www.w3.org/ns/shacl#ValidationReport"
],
"http://www.w3.org/ns/shacl#conforms": [
{
"@value": false
}
],
"http://www.w3.org/ns/shacl#result": [
{
"@id": "_:g451340"
},
{
"@id": "_:g451360"
}
]
},
{
"@id": "_:g451340",
"@type": [
"http://www.w3.org/ns/shacl#ValidationResult"
],
"http://www.w3.org/ns/shacl#focusNode": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#InvalidResource1"
}
],
"http://www.w3.org/ns/shacl#resultPath": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#property"
}
],
"http://www.w3.org/ns/shacl#resultSeverity": [
{
"@id": "http://www.w3.org/ns/shacl#Info"
}
],
"http://www.w3.org/ns/shacl#sourceConstraintComponent": [
{
"@id": "http://www.w3.org/ns/shacl#DatatypeConstraintComponent"
}
],
"http://www.w3.org/ns/shacl#sourceShape": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#TestShape2"
}
],
"http://www.w3.org/ns/shacl#value": [
{
"@value": true
}
]
},
{
"@id": "_:g451360",
"@type": [
"http://www.w3.org/ns/shacl#ValidationResult"
],
"http://www.w3.org/ns/shacl#focusNode": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#InvalidResource1"
}
],
"http://www.w3.org/ns/shacl#resultSeverity": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#MySeverity"
}
],
"http://www.w3.org/ns/shacl#sourceConstraintComponent": [
{
"@id": "http://www.w3.org/ns/shacl#NodeKindConstraintComponent"
}
],
"http://www.w3.org/ns/shacl#sourceShape": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#TestShape1"
}
],
"http://www.w3.org/ns/shacl#value": [
{
"@id": "http://datashapes.org/sh/tests/core/misc/severity-002.test#InvalidResource1"
}
]
}
]
2 changes: 1 addition & 1 deletion json-ld.gemspec
100644 → 100755
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
gem.homepage = "https://github.com/ruby-rdf/json-ld"
gem.license = 'Unlicense'
gem.summary = "JSON-LD reader/writer for Ruby."
gem.description = "JSON::LD parses and serializes JSON-LD into RDF and implements expansion, compaction and framing API interfaces."
gem.description = "JSON::LD parses and serializes JSON-LD into RDF and implements expansion, compaction and framing API interfaces for the Ruby RDF.rb library suite."

gem.authors = ['Gregg Kellogg']
gem.email = 'public-linked-json@w3.org'
Expand Down

0 comments on commit c8b2fe7

Please sign in to comment.