Skip to content

JSON-LD 1.1 Support #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 52 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2252083
Fix example_test expand test
kazarena Dec 13, 2019
12ec0a2
Fix expand-manifest.jsonld#t0081 test case and update test suite supp…
kazarena Dec 13, 2019
57a11a0
Fix expand-manifest.jsonld#t0114 test case. Allow duplicate entries f…
kazarena Dec 13, 2019
ca3fcfe
Terms that beging with a ':' are not considered absolute or compact IRIs
kazarena Dec 15, 2019
a3dcb39
Update ignored keyword patterns to be like `@[a-zA-z]+`.
kazarena Dec 15, 2019
83d9fc7
Support @protected terms
kazarena Dec 17, 2019
fda5de4
Support @propagate and limit @type-scoped terms to their typed object
kazarena Dec 19, 2019
85ed9ac
Support @direction. Includes a major revamp of the Compact algorithm …
kazarena Dec 21, 2019
ab4a282
Ensure that @vocab defined as a compact IRI expands properly + additi…
kazarena Dec 22, 2019
b8727bf
Check for relative IRIs as terms spoofing
kazarena Dec 22, 2019
c69b954
Disallow @index in term definitions
kazarena Dec 22, 2019
4e9ef87
Support @included
kazarena Dec 22, 2019
3bfae38
Support JSON Literals in expand operation
kazarena Dec 22, 2019
6ce733c
Support list of lists
kazarena Dec 24, 2019
2bff2b2
Indexing on @type requires @type to be either @id or @vocab, and defa…
kazarena Dec 24, 2019
1978584
Expand and compact property-based indexes
kazarena Dec 27, 2019
3cd6c43
Implement @import
kazarena Dec 28, 2019
22315d4
Add support for `@type: @none` in term definitions
kazarena Dec 28, 2019
b4e4568
Update Expand tests from https://w3c.github.io/json-ld-api/tests
kazarena Dec 28, 2019
ee87417
Support @json in Compact algorithm
kazarena Dec 28, 2019
6fbd81c
Support multiple @included when compacting a graph container
kazarena Dec 28, 2019
beded1c
Update Compaction algorithm to support type scoped contexts
kazarena Dec 29, 2019
fa70b3e
Detect an attempt to compact an IRI which results in an absolute IRI …
kazarena Dec 29, 2019
4b6ab97
Fix issues identified by golangci-lint
kazarena Dec 29, 2019
3192b65
Fix protected context clearing check
kazarena Dec 29, 2019
73a1170
Fix a bug in type scoped context processing
kazarena Dec 29, 2019
a74f984
Update Compaction tests from https://w3c.github.io/json-ld-api/tests
kazarena Dec 29, 2019
b6f3600
Support list of lists in Flatten operation
kazarena Dec 30, 2019
a7f8550
Rewrite Flatten operation to conform to 1.1 spec
kazarena Dec 30, 2019
19e2190
Update Flatten tests from https://w3c.github.io/json-ld-api/tests
kazarena Dec 30, 2019
c43a3af
Fix framing issues to have all _old_ framing tests passing with 1.1 e…
kazarena Dec 30, 2019
2772828
Support lists of lists in To-RDF operation
kazarena Jan 7, 2020
2da2c57
Add vocabulary and other static files from the official test suite
kazarena Jan 7, 2020
2c7f8d0
Update toRdf algorithm to require that all triples and graph names be…
kazarena Jan 8, 2020
88954b3
Update ToRdf tests from https://w3c.github.io/json-ld-api/tests
kazarena Jan 8, 2020
dffefee
Update toRdf tests from official suite and skip failing tests
kazarena Jan 8, 2020
6139c56
Support list of lists in FromRdf algorithm
kazarena Jan 8, 2020
090dbfe
Update FromRdf tests from https://w3c.github.io/json-ld-api/tests
kazarena Jan 8, 2020
f39d67c
Skip @json FromRDF tests
kazarena Jan 8, 2020
4acb391
Update remote-doc tests from https://w3c.github.io/json-ld-api/tests
kazarena Jan 8, 2020
51f82b4
Skip HMTL based Remote Doc tests
kazarena Jan 8, 2020
6cd6a5d
Add HTML tests from https://w3c.github.io/json-ld-api/tests
kazarena Jan 8, 2020
c4f33f9
Update static test suite files
kazarena Jan 8, 2020
4a9b0b2
Move Normalisation tests into a separate folder
kazarena Jan 8, 2020
60e6bc9
Refactor JSON-LD processor testing
kazarena Jan 8, 2020
b6858fd
Update official JSON-LD test suite
kazarena Jan 8, 2020
14c339f
Add all skipped tests
kazarena Jan 8, 2020
09737e1
Updated Normalisation test suite from https://github.com/json-ld/norm…
kazarena Jan 8, 2020
90072a0
Add test package dependencies
kazarena Jan 8, 2020
5cd5492
Update README with current conformance status
kazarena Jan 8, 2020
6b88bc0
Update documentation and examples and remove setting JSON-LD 1.1 mode…
kazarena Jan 8, 2020
d988aff
Update CHANGELOG
kazarena Jan 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# JSON-goLD Change Log

## v0.3.0 - 2020-01-08

- Substantial conformance to the latest W3C Recommendation for JSON-LD 1.1 specification.
- Default processing mode set to JSON-LD 1.1

### IMPORTANT NOTES

- JSON-LD 1.1 introduces several changes in internal (and some external) interfaces
- JSON-LD 1.1 algorithms are considerably more complex than 1.0. Performance impact hasn't been evaluated yet. There were no attempts yet to optimise the implementation.

## v0.2.0 - 2019-01-16

- JSON 1.1 support
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
.PHONY: all lint test fmt help
.PHONY: all vet lint test fmt help

all: lint test

lint:
vet:
go vet github.com/piprate/json-gold/...

test: lint
test: vet
go test github.com/piprate/json-gold/...

lint:
golangci-lint run

fmt:
gofmt -s -w .

Expand All @@ -17,7 +20,8 @@ help:
@echo '--------------------------------------------------'
@echo ' all - Run everything '
@echo ' fmt - Format code '
@echo ' lint - Run lint '
@echo ' lint - Run golangci-lint '
@echo ' vet - Run vet '
@echo ' test - Run all tests '
@echo '--------------------------------------------------'
@echo ''
71 changes: 45 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,50 @@ This library aims to pass the official [test suite](https://json-ld.org/test-sui
- [JSON-LD 1.0 Processing Algorithms and API](http://www.w3.org/TR/2014/REC-json-ld-api-20140116/),
W3C Recommendation,
2014-01-16, and any [errata](http://www.w3.org/2014/json-ld-errata)
- [JSON-LD 1.1](https://json-ld.org/spec/FCGS/json-ld/20180607/),
Final Community Group Report,
2018-06-07 or [newer JSON-LD latest](https://json-ld.org/spec/latest/json-ld/)
- [JSON-LD 1.1 Processing Algorithms and API](https://json-ld.org/spec/ED/json-ld-api/20180215/),
W3C Editor's Draft,
2018-12-15 or [newer <JSON-LD Processing Algorithms and API latest](https://json-ld.org/spec/latest/json-ld-api/)
- [JSON-LD Framing 1.1](https://json-ld.org/spec/latest/json-ld-framing/)
Draft Community Group Report
2018-09-05 or newer

As of April 30th, 2019:

* 89.9% of tests from the [official JSON-LD test suite](https://github.com/json-ld/json-ld.org/tree/master/test-suite) pass. The failing tests are related to HTML based checks and the most recently added features of JSON 1.1 spec.
- [JSON-LD 1.1](https://www.w3.org/TR/2019/CR-json-ld11-20191212/),
W3C Candidate Recommendation,
2019-12-12 or [newer JSON-LD latest](https://json-ld.org/spec/latest/json-ld/)
- [JSON-LD 1.1 Processing Algorithms and API](https://www.w3.org/TR/2019/CR-json-ld11-api-20191212/),
W3C Candidate Recommendation,
2019-12-12 or [newer JSON-LD Processing Algorithms and API latest](https://www.w3.org/TR/json-ld11-api/)
- [JSON-LD Framing 1.1](https://www.w3.org/TR/2019/CR-json-ld11-framing-20191212/)
W3C Candidate Recommendation
2019-12-12 or [newer](https://www.w3.org/TR/json-ld11-framing/)

### Current JSON-LD 1.1 Conformance Status

This library provides comprehensive support of JSON-LD 1.1 specification, except in the areas mentioned below:

#### Expansion

Good coverage.

#### Compaction

Good coverage, except:

- `@included` directive not supported

#### RDF Serialization/Deserialization

Good coverage, except:

- JSON literals (`@json`) aren't supported
- `rdfDirection` option is not yet supported (including _i18n-datatype_ and _compound-literal_ forms)

#### HTML based processing

Not supported.

### Current JSON-LD 1.1 Framing Conformance Status

Not supported. The current implementation is still based on an earlier version of JSON-LD 1.1 Framing specification.

### Official 1.1 Test Suite

As of January 8th, 2020:

* 88.7% of tests from the [official JSON-LD test suite](https://github.com/json-ld/json-ld.org/tree/master/test-suite) pass.
* all RDF Dataset Normalisation tests from the [current test suite](https://json-ld.github.io/normalization/tests/index.html) pass

## Examples ##
Expand Down Expand Up @@ -74,8 +105,6 @@ See complete code in [examples/compact.go](examples/compact.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1

doc := map[string]interface{}{
"@id": "http://example.org/test#book",
Expand Down Expand Up @@ -105,8 +134,6 @@ See complete code in [examples/flatten.go](examples/flatten.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1

doc := map[string]interface{}{
"@context": []interface{}{
Expand Down Expand Up @@ -138,8 +165,6 @@ See complete code in [examples/frame.go](examples/frame.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1

doc := map[string]interface{}{
"@context": map[string]interface{}{
Expand Down Expand Up @@ -193,8 +218,6 @@ See complete code in [examples/to_rdf.go](examples/to_rdf.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1
options.Format = "application/n-quads"

// this JSON-LD document was taken from http://json-ld.org/test-suite/tests/toRdf-0028-in.jsonld
Expand Down Expand Up @@ -227,8 +250,6 @@ See complete code in [examples/from_rdf.go](examples/from_rdf.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1

triples := `
<http://example.com/Subj1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Type> .
Expand All @@ -248,8 +269,6 @@ See complete code in [examples/normalize.go](examples/normalize.go).
```go
proc := ld.NewJsonLdProcessor()
options := ld.NewJsonLdOptions("")
// add the processing mode explicitly if you need JSON-LD 1.1 features
options.ProcessingMode = ld.JsonLd_1_1
options.Format = "application/n-quads"
options.Algorithm = "URDNA2015"

Expand All @@ -269,7 +288,7 @@ normalizedTriples, err := proc.Normalize(doc, options)

## Inspiration ##

This implementation was heavily influenced by [JSONLD-Java](https://github.com/jsonld-java/jsonld-java) with some techniques borrowed from [PyLD](https://github.com/digitalbazaar/pyld) and [gojsonld](https://github.com/linkeddata/gojsonld). Big thank you to the contributors of the forementioned libraries for figuring out implementation details of the core algorithms.
This implementation was influenced by [Ruby JSON-LD reader/writer](https://github.com/ruby-rdf/json-ld), [JSONLD-Java](https://github.com/jsonld-java/jsonld-java) with some techniques borrowed from [PyLD](https://github.com/digitalbazaar/pyld) and [gojsonld](https://github.com/linkeddata/gojsonld). Big thank you to the contributors of the aforementioned libraries for figuring out implementation details of the core algorithms.

## History ##

Expand Down
Loading