Skip to content
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

Use json-ld v0.6 #342

Closed
wants to merge 15 commits into from
Closed

Use json-ld v0.6 #342

wants to merge 15 commits into from

Conversation

clehner
Copy link
Contributor

@clehner clehner commented Nov 4, 2021

json-ld crate version 0.5 (changelog) v0.6 is published to crates.io. To use new features of json-ld, such as warnings (timothee-haudebourg/json-ld#26) or flattening (timothee-haudebourg/json-ld#29 in development), ssi will need to be updated to use json-ld's new JSON interface, including in the JSON-LD algorithms implemented (Node Map Generation, and RDF Deserialization). The use of JsonValue (json crate) is removed in json-ld v0.5. Instead, generic-json is used. In json-ld v0.6, serde_json::Value can be used without conversion (#342 (comment)).

@timothee-haudebourg
Copy link
Contributor

timothee-haudebourg commented Nov 8, 2021

If I may clarify, you should not have to use generic_json::Value or even add generic_json in your dependencies. generic_json is an abstraction layer used internally in the json-ld crate. On your side, you can use any JSON type that implements the generic_json::Json trait. For now this is only the case of ijson::Value. Since my PR has been merged, I should have all I need to add support for serde_json::Value soon, so you can keep it.

@clehner
Copy link
Contributor Author

clehner commented Nov 8, 2021

Great, thanks @timothee-haudebourg!

@timothee-haudebourg
Copy link
Contributor

I've added support for serde_json (starting with version 1.0.69). All you need is to enable the generic-json/serde_json-impl feature for json-ld. I had to release a new major version of generic_json so for now it only works with json-ld master branch, not with version 0.5, but I should release a new version soon.

@clehner
Copy link
Contributor Author

clehner commented Nov 8, 2021

Excellent.

I just remembered though about using generic_associated_types preventing use of Rust Stable currently, that I think also will block this PR for now.

@clehner
Copy link
Contributor Author

clehner commented Jan 7, 2022

Build with nightly fails because of missing implementation of std::hash::Hash on serde_json::Value:
https://github.com/spruceid/ssi/runs/4743260155?check_suite_focus=true#step:5:667
Discussed with @timothee-haudebourg: an attempt was made to add Hash to serde_json::Value: serde-rs/json#790; without that, we can use generic-json's IValue implementation instead, which has Hash implemented.

This is using serde_json 1.0.74, generic-json v0.5.1 with serde_json-impl, and timothee-haudebourg/json-ld#31.

@clehner
Copy link
Contributor Author

clehner commented Jan 13, 2022

Attempted to convert from ijson::IValue to serde_json::Value via the json_to_json function in json-ld, but number conversion doesn't work. Looks like explicit conversion is needed. Edit: maybe can just use serde_json::to_value(&ivalue), since IValue implements serialize.

error[E0277]: the trait bound `serde_json::Number: From<INumber>` is not satisfied
    --> src/jsonld.rs:1692:57
     |
1692 |     let documents = expanded_doc.iter().map(|item| item.as_json()).collect();
     |                                                         ^^^^^^^ the trait `From<INumber>` is not implemented for `serde_json::Number`
     |
     = help: the following implementations were found:
               <serde_json::Number as From<i16>>
               <serde_json::Number as From<i32>>
               <serde_json::Number as From<i64>>
               <serde_json::Number as From<i8>>
             and 7 others
note: required by a bound in `json_ld::util::AsJson::as_json`
    --> /home/cel/.cargo/git/checkouts/json-ld-3a2d3e1fc81eaf56/681464d/src/util/json/build.rs:13:35
     |
13   | pub trait AsJson<J: JsonClone, K: JsonFrom<J>> {
     |                                   ^^^^^^^^^^^ required by this bound in `json_ld::util::AsJson::as_json`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `ssi` due to previous error

@clehner
Copy link
Contributor Author

clehner commented Jan 13, 2022

Conversion from IValue is implemented; the crate compiles and runs now. But RDF Deserialization is not working now. These changes could be examined to see if any obvious bugs have been introduced. Probably we should just use the RDF Serialization implementation being added in timothee-haudebourg/json-ld#29; then the implementation of it in ssi (which this PR currently changes to use Value instead of JsonValue) could be dropped.

Also there is something going on in did-tezos with StdError:
https://github.com/spruceid/ssi/runs/4807140500?check_suite_focus=true#step:5:631

error in did-tezos
error[E0277]: `(dyn StdError + 'static)` cannot be sent between threads safely
  --> did-tezos/src/explorer.rs:87:6
   |
87 |     )?))
   |      ^ `(dyn StdError + 'static)` cannot be sent between threads safely
   |
   = help: the trait `Send` is not implemented for `(dyn StdError + 'static)`
   = note: required because of the requirements on the impl of `Send` for `Unique<(dyn StdError + 'static)>`
   = note: required because it appears within the type `Box<(dyn StdError + 'static)>`
   = note: required because it appears within the type `std::option::Option<Box<(dyn StdError + 'static)>>`
   = note: required because it appears within the type `json_ld::error::Error`
   = note: required because it appears within the type `json_ld::loc::Loc<json_ld::error::Error, ()>`
   = note: required because it appears within the type `ssi::error::Error`
   = note: required because of the requirements on the impl of `From<ssi::error::Error>` for `anyhow::Error`
   = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, ssi::error::Error>>` for `Result<ssi::did::VerificationMethod, anyhow::Error>`
errors in toRdf
---- jsonld::tests::to_rdf_test_suite stdout ----
test #t0003: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .


test #t0007: failed. diff:
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .


test #t0014: failed: IRI(InvalidPath)
test #t0015: failed: IRI(InvalidPath)
test #t0016: failed. diff:
<https://w3c.github.io/json-ld-api/tests/toRdf/0016-in.jsonld> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .


test #t0017: failed. diff:
<https://w3c.github.io/json-ld-api/tests/toRdf/a/b> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .


test #t0018: failed. diff:
<https://w3c.github.io/json-ld-api/tests/toRdf/0018-in.jsonld#frag> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .


test #t0025: failed: IRI(InvalidPath)
test #t0026: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Resource> .


test #t0027: failed. diff:
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.britannica.com/> .
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.brockhaus.de/> .
<http://example.org/ParisFact1> <http://example.org/hasReference> <http://www.wikipedia.org/> .
<http://example.org/ParisFact1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
<http://example.org/ParisFact2> <http://example.org/hasReference> <http://www.wikipedia.org/> .
<http://example.org/ParisFact2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .
<http://example.org/location/Paris#this> <http://example.org/hasPopulation> "7000000"^^<http://www.w3.org/2001/XMLSchema#integer> <http://example.org/ParisFact2> .
<http://example.org/location/Paris#this> <http://example.org/locatedIn> <http://example.org/location/France#this> <http://example.org/ParisFact1> .


test #t0028: failed. diff:
<http://example.org/fact1> <http://purl.org/dc/terms/title> "Hello World!" <http://example.org/sig1> .
<http://example.org/sig1> <http://purl.org/dc/terms/created> "2011-09-23T20:21:34Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.org/sig1> <http://purl.org/security#signatureValue> "OGQzNGVkMzVm4NTIyZTkZDYMmMzQzNmExMgoYzI43Q3ODIyOWM32NjI=" .
<http://example.org/sig1> <http://purl.org/security#signer> <http://payswarm.example.com/i/john/keys/5> .
<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/security#SignedGraph> .
<http://example.org/sig1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Graph> .


test #t0029: failed. diff:
<http://data.wikipedia.org/snaks/Assertions> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#SnakSet> .
<http://data.wikipedia.org/snaks/BerlinFact> <http://data.wikipedia.org/vocab#assertedBy> "http://www.statistik-berlin-brandenburg.de/" <http://data.wikipedia.org/snaks/Assertions> .
<http://data.wikipedia.org/snaks/BerlinFact> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.wikipedia.org/vocab#Snak> <http://data.wikipedia.org/snaks/Assertions> .
<http://en.wikipedia.org/wiki/Berlin> <http://data.wikipedia.org/vocab#population> "3499879"^^<http://www.w3.org/2001/XMLSchema#integer> <http://data.wikipedia.org/snaks/BerlinFact> .


test #t0030: failed. diff:
<http://example.org/linked-data-graph> <http://example.org/asOf> "2012-04-09"^^<http://www.w3.org/2001/XMLSchema#date> .
<http://greggkellogg.net/foaf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/knows> "http://manu.sporny.org/i/public" <http://example.org/linked-data-graph> .
<http://greggkellogg.net/foaf#me> <http://xmlns.com/foaf/0.1/name> "Gregg Kellogg" <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foaf:Person> <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/knows> "http://greggkellogg.net/foaf#me" <http://example.org/linked-data-graph> .
<http://manu.sporny.org/i/public> <http://xmlns.com/foaf/0.1/name> "Manu Sporny" <http://example.org/linked-data-graph> .


test #t0036: failed: IRI(InvalidPath)
test #t0118: skipping: requires Generalized RDF
test #tc006: failed. diff:
_:c14n0 <http://example/a> _:c14n1 .
_:c14n1 <http://example.org/bar> "baz" .

_:c14n0 <http://example.org/bar> "baz" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .
_:c14n1 <http://example/a> _:c14n0 .


test #tc007: failed. diff:
_:c14n0 <http://example/a> _:c14n1 .
_:c14n1 <http://example/bar> <http://example/baz> .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tc008: failed. diff:
_:c14n0 <http://example/a> _:c14n1 .
_:c14n1 <http://example.org/bar> "baz" .

_:c14n0 <http://example.org/bar> "baz" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .
_:c14n1 <http://example/a> _:c14n0 .


test #tc009: failed. diff:
_:c14n0 <http://example/baz> "buzz" .
_:c14n1 <http://example/bar> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tc010: failed. diff:
_:c14n0 <http://example.com/a> "A in example.com" .
_:c14n0 <http://example.org/c> "C in example.org" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/B> .
_:c14n1 <http://example/a> _:c14n0 .
_:c14n1 <http://example/c> "C in example" .


test #tc011: failed. diff:
_:c14n0 <http://example.org/foo> <urn:bar> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/t1> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/t2> .


test #tc012: failed. diff:
_:c14n0 <http://example/bar> _:c14n1 .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .
_:c14n1 <http://example/baz> <http://example/buzz> .


test #tc013: failed. diff:
<http://example/inner-with-index> <http://example/inner-foo> "inner-foo" .
_:c14n0 <http://example/prop> <http://example/inner-with-index> .
_:c14n1 <http://example/base-foo> "base-foo" .
_:c14n1 <http://example/outer-prop> _:c14n0 .
_:c14n0 <http://example/base-foo> "base-foo" .
_:c14n0 <http://example/outer-prop> _:c14n1 .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Outer> .
_:c14n1 <http://example/prop> <http://example/inner-with-index> .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Inner> .


test #tc014: failed. diff:
_:c14n0 <http://example/foo> "will-exist" .
_:c14n0 <http://example/p> _:c14n1 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Type> .


test #tc015: failed. diff:
<http://example/base-base#base-id> <http://example/p> <http://example/typed-base#typed-id> .
<http://example/base-base#nested-id> <http://example/foo> "bar" .
<http://example/typed-base#typed-id> <http://example/nestedNode> <http://example/base-base#nested-id> .
<http://example/typed-base#typed-id> <http://example/subjectReference> <http://example/typed-base#subject-reference-id> .
<http://example/typed-base#typed-id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Type> .


test #tc016: failed. diff:
_:c14n0 <http://example.org/foo> "org" .
_:c14n0 <http://example.org/p> _:c14n1 .
_:c14n1 <http://example.com/foo> "com" .
_:c14n1 <http://example.com/nested> _:c14n2 .
_:c14n2 <http://example.org/nested-prop> "org" .
_:c14n0 <http://example.org/p> _:c14n2 .
_:c14n1 <http://example.org/nested-prop> "org" .
_:c14n2 <http://example.com/foo> "com" .
_:c14n2 <http://example.com/nested> _:c14n1 .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Type> .


test #tc017: failed. diff:
_:c14n0 <http://example/prop> "vocab" .
_:c14n1 <http://example/foo-prop> "foo" .
_:c14n1 <http://example/nested> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Bar> .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tc018: failed. diff:
_:c14n0 <http://example/foo-prop> "foo" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Bar> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tc019: failed. diff:
_:c14n0 <http://example/base-prop> "baz" .
_:c14n1 <http://example/bar> _:c14n3 .
_:c14n1 <http://example/baz> _:c14n0 .
_:c14n1 <http://example/foo> _:c14n2 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Type> .
_:c14n2 <http://example/foo-prop> "foo" .
_:c14n3 <http://example/bar-prop> "bar" .


test #tc020: failed. diff:
_:c14n0 <http://example/v> "value"^^<http://example/value-type> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Type> .


test #tc021: failed. diff:
_:c14n0 <ex:typed> "v5" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Type> .
_:c14n1 <ex:typed> "v1" .
_:c14n1 <ex:typed> "v2" .
_:c14n1 <ex:typed> "v3" .
_:c14n1 <ex:typed> _:c14n2 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Type> .
_:c14n2 <ex:untyped> "v4" .
_:c14n2 <ex:untyped> _:c14n0 .
_:c14n3 <ex:untyped> _:c14n1 .


test #tc022: failed. diff:
_:c14n0 <ex:foo> <ex:Bar> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Type> .


test #tc023: failed. diff:
_:c14n0 <ex:foo> <ex:Foo> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Inner> .
_:c14n1 <ex:nested> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Outer> .


test #tc024: failed. diff:
_:c14n0 <ex:bar> <http://example/a> .
_:c14n0 <ex:bar> <http://example/b> .
_:c14n0 <ex:foo> "1" .
_:c14n0 <ex:foo> "2"^^<ex:Number> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Inner> .
_:c14n1 <ex:nested> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Outer> .


test #tc025: failed. diff:
_:c14n0 <ex:nested> _:c14n2 .
_:c14n1 <ex:foo> "bar" _:c14n2 .

_:c14n0 <ex:nested> _:c14n1 .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Outer> .
_:c14n2 <ex:foo> "bar" _:c14n1 .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <ex:Inner> _:c14n1 .


test #tc026: failed. diff:
_:c14n0 <http://example/bar> _:c14n1 .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .
_:c14n1 <http://example/baz> <http://example/buzz> .


test #tc038: failed. diff:
<http://example.org/base/book/one> <http://purl.org/dc/terms/creator> _:c14n1 .
<http://example.org/base/book/one> <http://purl.org/dc/terms/published> "1999" .
<http://example.org/base/book/one> <http://purl.org/dc/terms/publisher> _:c14n0 .
<http://example.org/base/book/one> <http://purl.org/ontology/bibo/isbn> "1234567890" .
<http://example.org/base/book/one> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/ontology/bibo/Book> .
_:c14n0 <http://www.w3.org/2000/01/rdf-schema#label> "PubCorp" .
_:c14n1 <http://www.w3.org/2000/01/rdf-schema#label> "Some Body" .


test #tdi03: failed: IRI(InvalidPath)
test #tdi09: skipping: non-normative
test #tdi10: skipping: non-normative
test #tdi11: skipping: non-normative
test #tdi12: skipping: non-normative
test #te002: failed. diff:
<http://example.com/id1> <http://example.com/term1> "v1" .
<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
<http://example.com/id1> <http://example.com/term3> "v3"@en .
<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .


test #te004: failed: IRI(InvalidPath)
test #te013: failed. diff:
<http://example.com/id1> <http://example.com/term1> "v1" .
<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
<http://example.com/id1> <http://example.com/term3> "v3"@en .
<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .


test #te014: skipping: spec version 'json-ld-1.0'
test #te016: failed: IRI(InvalidPath)
test #te023: failed: IRI(InvalidPath)
test #te025: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/foo/bar> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/underscore/> .


test #te026: skipping: spec version 'json-ld-1.0'
test #te027: failed: IRI(InvalidPath)
test #te028: failed. diff:
<https://w3c.github.io/json-ld-api/tests/toRdf/example1> <http://example.org/vocab#date> "2011-01-25T00:00:00Z"^^<http://example.org/vocab#dateTime> .
<https://w3c.github.io/json-ld-api/tests/toRdf/example1> <http://example.org/vocab#embed> <https://w3c.github.io/json-ld-api/tests/toRdf/example2> .
<https://w3c.github.io/json-ld-api/tests/toRdf/example1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#test> .
<https://w3c.github.io/json-ld-api/tests/toRdf/example2> <http://example.org/vocab#expandedDate> "2012-08-01T00:00:00Z"^^<http://example.org/vocab#dateTime> .


test #te029: failed: IRI(InvalidPath)
test #te038: skipping: spec version 'json-ld-1.0'
test #te059: failed. diff:
<https://w3c.github.io/json-ld-api/tests/toRdf/example-vocab-reset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3c.github.io/json-ld-api/tests/toRdf/document-relative> .
<https://w3c.github.io/json-ld-api/tests/toRdf/example-with-vocab> <http://example.org/vocab#embed> <https://w3c.github.io/json-ld-api/tests/toRdf/example-vocab-reset> .
<https://w3c.github.io/json-ld-api/tests/toRdf/example-with-vocab> <http://example.org/vocab#property> "property expanded using @vocab" .
<https://w3c.github.io/json-ld-api/tests/toRdf/example-with-vocab> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#vocab-prefixed> .


test #te060: failed. diff:
<http://example.org/document-base-overwritten> <http://example.com/vocab#property> <https://w3c.github.io/json-ld-api/tests/document-relative> .
<http://example.org/document-base-overwritten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/test/#document-base-overwritten> .
<https://w3c.github.io/json-ld-api/tests/document-relative> <http://example.com/vocab#property> <http://example.org/document-base-overwritten> .
<https://w3c.github.io/json-ld-api/tests/document-relative> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3c.github.io/json-ld-api/tests/toRdf/e060-in.jsonld#document-relative> .


test #te062: failed: IRI(InvalidPath)
test #te067: failed. diff:
<http://example.org/node1> <http://example.org/property> "all these IRIs remain unchanged because they are interpreted as absolute IRIs" .
<http://example.org/node1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/type> .


test #te068: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:c14n1 .


test #te069: failed. diff:
<http://example.com/vocab#class> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://example.com/vocab#class> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://example.com/vocab#someOtherClass> .


test #te070: failed. diff:
<http://example.com/vocab#id> <http://www.example.org/vocab#foo> "bar" .
<http://example.com/vocab#id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/vocab#Class> .


test #te071: skipping: spec version 'json-ld-1.0'
test #te075: skipping: requires Generalized RDF
test #te077: failed. diff:
<http://example.com/id1> <http://example.com/term1> "v1" .
<http://example.com/id1> <http://example.com/term2> "v2"^^<http://example.com/t2> .
<http://example.com/id1> <http://example.com/term3> "v3"@en .
<http://example.com/id1> <http://example.com/term4> "4"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "50"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://example.com/term5> "51"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/id1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/t1> .


test #te114: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Type1> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Type2> .


test #te115: skipping: spec version 'json-ld-1.0'
test #te116: skipping: spec version 'json-ld-1.0'
test #te118: failed. diff:
<foo:bar-id> <foo:bar> "is an absolute iri property" .
<foo:bar-id> <http://schema.org/:fish> "is schema.org/:fish" .
<foo:bar-id> <http://schema.org/term> "is schema.org/term" .
<foo:bar-id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <foo:bar-type> .


test #te122: skipping
test #ter02: skipping: spec version 'json-ld-1.0'
test #ter03: skipping: spec version 'json-ld-1.0'
test #ter24: skipping: spec version 'json-ld-1.0'
test #ter32: skipping: spec version 'json-ld-1.0'
test #tin05: failed. diff:
_:c14n0 <http://example.org/prop> _:c14n1 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Foo> .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/Bar> .


test #tin06: failed. diff:
<http://example.org/base/12> <http://example.org/vocab#author> <http://example.org/base/9> .
<http://example.org/base/12> <http://example.org/vocab#body> "I like XML better" .
<http://example.org/base/12> <http://example.org/vocab#self> <http://example.com/comments/12> .
<http://example.org/base/12> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#comments> .
<http://example.org/base/1> <http://example.org/vocab#author> <http://example.org/base/9> .
<http://example.org/base/1> <http://example.org/vocab#comments> _:c14n0 .
<http://example.org/base/1> <http://example.org/vocab#self> <http://example.com/articles/1> .
<http://example.org/base/1> <http://example.org/vocab#title> "JSON:API paints my bikeshed!" .
<http://example.org/base/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#articles> .
<http://example.org/base/2> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#people> .
<http://example.org/base/5> <http://example.org/vocab#author> <http://example.org/base/2> .
<http://example.org/base/5> <http://example.org/vocab#body> "First!" .
<http://example.org/base/5> <http://example.org/vocab#self> <http://example.com/comments/5> .
<http://example.org/base/5> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#comments> .
<http://example.org/base/9> <http://example.org/vocab#first-name> "Dan" .
<http://example.org/base/9> <http://example.org/vocab#last-name> "Gebhardt" .
<http://example.org/base/9> <http://example.org/vocab#related> <http://example.com/articles/1/author> .
<http://example.org/base/9> <http://example.org/vocab#self> <http://example.com/articles/1/relationships/author> .
<http://example.org/base/9> <http://example.org/vocab#self> <http://example.com/people/9> .
<http://example.org/base/9> <http://example.org/vocab#twitter> "dgeb" .
<http://example.org/base/9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/vocab#people> .
_:c14n0 <http://example.org/vocab#related> <http://example.com/articles/1/comments> .
_:c14n0 <http://example.org/vocab#self> <http://example.com/articles/1/relationships/comments> .


test #tli01: failed: IRI(InvalidPath)
test #tli02: failed: IRI(InvalidPath)
test #tli03: failed: IRI(InvalidPath)
test #tli04: failed: IRI(InvalidPath)
test #tli05: failed: IRI(InvalidPath)
test #tli06: failed: IRI(InvalidPath)
test #tli07: failed: IRI(InvalidPath)
test #tli08: failed: IRI(InvalidPath)
test #tli09: failed: IRI(InvalidPath)
test #tli10: failed: IRI(InvalidPath)
test #tli11: failed: IRI(InvalidPath)
test #tli12: skipping
test #tli13: failed: IRI(InvalidPath)
test #tli14: failed: IRI(InvalidPath)
test #tm003: failed. diff:
_:c14n0 <http://example/label> "Object with @type _:bar" .
_:c14n0 <http://example/label> "Object with @type <foo>" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/foo> .
_:c14n1 <http://example/typemap> _:c14n0 .
_:c14n1 <http://example/typemap> _:c14n2 .
_:c14n2 <http://example/label> "Object with @type <foo>" .
_:c14n2 <http://example/label> "Object with @type _:bar" .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:c14n3 .


test #tm004: failed. diff:
_:c14n0 <http://example/label> "Object with @type _:bar" .
_:c14n0 <http://example/label> "Object with @type <foo>" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/bar> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/foo> .
_:c14n1 <http://example/typemap> _:c14n0 .
_:c14n1 <http://example/typemap> _:c14n2 .
_:c14n2 <http://example/label> "Object with @type <foo>" .
_:c14n2 <http://example/label> "Object with @type _:bar" .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:c14n3 .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:c14n4 .


test #tm006: failed. diff:
_:c14n0 <http://example/typemap> _:c14n1 .
_:c14n1 <http://example/label> "Object with @type <foo>" .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tm007: failed. diff:
_:c14n0 <http://example/typemap> _:c14n1 .
_:c14n1 <http://example/label> "Object with @type <foo>" .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #tm008: failed. diff:
_:c14n0 <http://example.org/a> "Object with @type <Type>" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Type> .
_:c14n1 <http://example/typemap> _:c14n0 .


test #tm017: failed. diff:
<http://example.org/base/baz> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/ns/bar> .
_:c14n0 <http://example.org/ns/foo> <http://example.org/base/baz> .


test #tm018: failed. diff:
<http://example.org/base/baz> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/ns/bar> .
_:c14n0 <http://example.org/ns/foo> <http://example.org/base/baz> .


test #tm019: failed. diff:
<http://example.org/ns/baz> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/ns/bar> .
_:c14n0 <http://example.org/ns/foo> <http://example.org/ns/baz> .


test #tn008: failed. diff:
_:c14n0 <http://example.org/p1> "v1" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/T1> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/T2> .


test #tpr22: failed. diff:
_:c14n0 <http://example.com/foo> _:c14n1 .
_:c14n1 <http://example.com/foo> <http://example.com/test> .

_:c14n0 <http://example.com/foo> <http://example.com/test> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Child> .
_:c14n1 <http://example.com/foo> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/Parent> .


test #tpr23: failed. diff:
<http://example/id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/type> .


test #tpr25: failed. diff:
_:c14n0 <http://example/bar-1> _:c14n4 .
_:c14n0 <http://example/foo> _:c14n1 .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Bar> .
_:c14n2 <http://example/bar-2> "bar-2" .
_:c14n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .
_:c14n3 <http://example/bar> <http://example/> _:c14n1 .
_:c14n4 <http://example/bar-2> _:c14n2 .


test #tpr27: failed. diff:
<http://example/id> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/type> .


test #tpr30: failed. diff:
<http://example.com/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/ns/Bar> .
<http://example.com/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/ns/Foo> .


test #tpr34: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tpr35: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tpr36: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tpr37: failed. diff:
_:c14n0 <http://example.org/ignoreMe> "vocabulary relative" .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tpr38: failed. diff:
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tpr39: failed. diff:
_:c14n0 <http://example.org/text> "not reversed" .
_:c14n1 <http://example.org/ignoreMe> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/IgnoreTest> .


test #tso05: failed. diff:
_:c14n0 <http://example.org/baz> <http://example/buzz> .
_:c14n1 <http://example/bar> _:c14n0 .
_:c14n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example/Foo> .


test #twf04: failed. diff:
<http://example.com/foo> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.com/bar> .


thread 'jsonld::tests::to_rdf_test_suite' panicked at 'assertion failed: `(left == right)`
  left: `351`,
 right: `444`', src/jsonld.rs:1881:9

@timothee-haudebourg
Copy link
Contributor

timothee-haudebourg commented Jan 13, 2022

Build with nightly fails because of missing implementation of std::hash::Hash on serde_json::Value

The more I think about it, the more I think I made a mistake here. I remember making some change specifically to acomodate the lack of Hash bound on serde_json::Value. In fact, I think it comes from the generic_json::JsonHash trait alias. The definition is:

pub trait JsonHash = Json + Hash
where
	<Self as Json>::Number: Hash,
	<Self as Json>::String: Hash;

The + Hash should not be here. I'm already using a custom json_ld::util::json::hash_json hashing function so that the JSON implementation does not need to provide one. I'm fixing it here timothee-haudebourg/json-ld/issues/32.

@timothee-haudebourg
Copy link
Contributor

Should be fixed in the latest version 0.6.0. I'm now using serde_json::Value in all the tests and examples and it works fine.

@clehner
Copy link
Contributor Author

clehner commented Jan 20, 2022

Attempting to integrate json-ld v0.6, using serde_json::Value again.
Build failure occurs: https://github.com/spruceid/ssi/runs/4884884733?check_suite_focus=true#step:5:910
Opened issue: timothee-haudebourg/json-ld#33

@clehner clehner changed the title Use json-ld v0.5 Use json-ld v0.6 Jan 20, 2022
@clehner
Copy link
Contributor Author

clehner commented Jan 24, 2022

Issue with serde_json::Value is fixed in json-ld v0.6.1: timothee-haudebourg/json-ld#33 (comment)

Other things mentioned in #342 (comment) still occur:

  • StdError in did-tz failure (doesn't look related to json-ld)
  • RDF Deserialization and other test failures (looks like those that depend on RDF deserialization)
ssi crate test failures
    jsonld::tests::to_rdf_test_suite
    ldp::tests::ed2020
    ldp::tests::tezos_vm_tz1
    vc::tests::credential_issue_verify
    vc::tests::credential_issue_verify_bs58
    vc::tests::credential_issue_verify_no_z
    vc::tests::credential_json_to_urdna2015
    vc::tests::credential_proof_preparation
    vc::tests::credential_status
    vc::tests::credential_verify
    vc::tests::credential_verify_proof_consistency
    vc::tests::presentation_from_credential_issue_verify
    vc::tests::presentation_verify
    vc::tests::proof_json_to_urdna2015
    zcap::tests::round_trip

@clehner
Copy link
Contributor Author

clehner commented Mar 3, 2022

Tested with timothee-haudebourg/json-ld#29.

jsonld::tests::to_rdf_test_suite is still at 351/444.

Error in did-tz looks like it is related to json_ld::error::Error:

Error in did-tz

https://github.com/spruceid/ssi/runs/5408065687?check_suite_focus=true#step:5:951

 error[E0277]: `(dyn StdError + 'static)` cannot be shared between threads safely
   --> did-tezos/src/lib.rs:552:68
    |
552 |                         let (_, patch_) = decode_verify(&jws, &jwk)?;
    |                                                                    ^ `(dyn StdError + 'static)` cannot be shared between threads safely
    |
    = help: the trait `Sync` is not implemented for `(dyn StdError + 'static)`
    = note: required because of the requirements on the impl of `Sync` for `Unique<(dyn StdError + 'static)>`
    = note: required because it appears within the type `Box<(dyn StdError + 'static)>`
    = note: required because it appears within the type `std::option::Option<Box<(dyn StdError + 'static)>>`
    = note: required because it appears within the type `json_ld::error::Error`
    = note: required because it appears within the type `json_ld::loc::Loc<json_ld::error::Error, ()>`
    = note: required because it appears within the type `ssi::error::Error`
    = note: required because of the requirements on the impl of `From<ssi::error::Error>` for `anyhow::Error`
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, ssi::error::Error>>` for `Result<(), anyhow::Error>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `did-tz` due to 8 previous errors

@sbihel
Copy link
Member

sbihel commented Dec 9, 2022

Will open a new PR for v0.8

@sbihel sbihel closed this Dec 9, 2022
@sbihel sbihel deleted the feat/json-ld-0.5 branch December 9, 2022 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants