Skip to content

Commit

Permalink
Merge pull request #24 from piprate/json11-dec-2019
Browse files Browse the repository at this point in the history
JSON-LD 1.1 Support
  • Loading branch information
kazarena authored Jan 9, 2020
2 parents f0fdd01 + d988aff commit 0dbcf4d
Show file tree
Hide file tree
Showing 1,461 changed files with 61,150 additions and 4,011 deletions.
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

0 comments on commit 0dbcf4d

Please sign in to comment.