You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jean-Marc Vanel <je...@gmail.com> on 2022/05/11 08:12:18 UTC

JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

The context is that I'm debugging a JSON API with JSON-LD keys and an
@context that I recommended .

riot from Jena 4.5.0 says :
$JENA/bin/riot --syntax=json-ld --verbose --debug 78272_pp-absolute.jsonld
09:42:21 ERROR riot            :: There was a problem encountered loading a
remote context [code=LOADING_REMOTE_CONTEXT_FAILED].

but using directly JsonLd.toRdf() succeeds :

import com.apicatalog.jsonld._
import scala.collection.JavaConverters._
val res2 = JsonLd.toRdf("file:/home/jmv/data/
grottocenter.org/tests_2022-05-10/78272_pp-absolute.jsonld")
  .get() .toList.asScala
for ( e <- res2 )
    println ( "<" + e.getSubject + "> <" + e.getPredicate + "> " +
e.getObject )

<_:b0> <http://purl.org/dc/terms/created> 2022-04-14T10:44:18.228Z^^
http://www.w3.org/2001/XMLSchema#string
<_:b0> <http://purl.org/dc/terms/creator> 3188^^
http://www.w3.org/2001/XMLSchema#integer
<_:b0> <http://purl.org/dc/terms/spatial> 78272^^
http://www.w3.org/2001/XMLSchema#integer
<_:b0> <http://www.w3.org/2000/01/rdf-schema#label> Trou de Beget^^
http://www.w3.org/2001/XMLSchema#string
etc ...

I'm afraid that it would not work with Jena API either.
As a side question, is there a way to configure riot or Jena API to have
(more) verbose JSON-LD error messages, possibly with line numbers.
Another side question, it seems that riot no longer accepts HTTP URL's ,
only files. Of course , it's easy to use wget or other tools, but that was
convenient ...

The test data are here : http://jmvanel.free.fr/test/?M=D

Jean-Marc Vanel
<http://semantic-forms.cc:1952/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr
 Chroniques jardin
<http://semantic-forms.cc:1952/history?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FChronicle>

Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Andy Seaborne <an...@apache.org>.
On 11/05/2022 09:12, Jean-Marc Vanel wrote:
> Another side question, it seems that riot no longer accepts HTTP URL's ,
> only files.

It wasn't intended.
This is now fixed.

     Andy


Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Andy Seaborne <an...@apache.org>.

On 11/05/2022 14:02, Jean-Marc Vanel wrote:
> Le mer. 11 mai 2022 à 11:51, Andy Seaborne <an...@apache.org> a écrit :
> 
>>
>> On 11/05/2022 09:12, Jean-Marc Vanel wrote:
>>
>>> As a side question, is there a way to configure riot or Jena API to have
>>> (more) verbose JSON-LD error messages, possibly with line numbers.
>>
>> Does titanium provide this information?
>>
> 
> line numbers, not currently ;
> but JsonPath could be produced by Titanium ; see (stale) issue
> https://github.com/filip26/titanium-json-ld/issues/71

Something to discuss with Titanium.
I'm sure a PR to that project will be welcome.

> See also my issue where discussion about JSON-LD error messages started:
> https://github.com/filip26/titanium-json-ld/issues/59
> 
> Maybe Jena could catch com.apicatalog.jsonld.JsonLdError ...

It does - see LangJSONLD11.handleJsonLdError().

> 
> Anyway the question remains of why does Titanium succeed where Jena / riot
> fails on the same data ?
> How can I help investigate ?

by providing a complete minimal example.

All the information so far is

"""
There was a problem encountered loading a
remote context
"""

Could you produce a small example from 78272_pp-absolute.jsonld?

This works for me.

"@context": "https://www.schema.org",


> 
> NOTE, Titanium has a CLI :
> 
> JSON-LD-CLI <https://github.com/filip26/json-ld-cli> is a native command
> line utility for Ubuntu, Mac, Windows
> 

Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Jean-Marc Vanel <je...@gmail.com>.
Le mer. 11 mai 2022 à 11:51, Andy Seaborne <an...@apache.org> a écrit :

>
> On 11/05/2022 09:12, Jean-Marc Vanel wrote:
>
> > As a side question, is there a way to configure riot or Jena API to have
> > (more) verbose JSON-LD error messages, possibly with line numbers.
>
> Does titanium provide this information?
>

line numbers, not currently ;
but JsonPath could be produced by Titanium ; see (stale) issue
https://github.com/filip26/titanium-json-ld/issues/71

See also my issue where discussion about JSON-LD error messages started:
https://github.com/filip26/titanium-json-ld/issues/59

Maybe Jena could catch com.apicatalog.jsonld.JsonLdError ...

Anyway the question remains of why does Titanium succeed where Jena / riot
fails on the same data ?
How can I help investigate ?

NOTE, Titanium has a CLI :

JSON-LD-CLI <https://github.com/filip26/json-ld-cli> is a native command
line utility for Ubuntu, Mac, Windows

Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Andy Seaborne <an...@apache.org>.

On 11/05/2022 09:12, Jean-Marc Vanel wrote:

> As a side question, is there a way to configure riot or Jena API to have
> (more) verbose JSON-LD error messages, possibly with line numbers.

Does titanium provide this information?

Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Jean-Marc Vanel <je...@gmail.com>.
Jean-Marc Vanel
<http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
+33
(0)6 89 16 29 52


Le mer. 11 mai 2022 à 11:48, Andy Seaborne <an...@apache.org> a écrit :

> What version of java are you running? Is it 11.0.14?
>
NO
java --version
openjdk *11.0.15* 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed
mode, sharing)

>
> Does 78272_pp-absolute.jsonld use a https URL in @context?
>
No , for the purpose of easy testing , I put file: URL's everywhere .

>
> You can use --syntax jsonld10 to get jsonld-java.
>
OK. Not my use currently .



>      Andy
>
> On 11/05/2022 09:12, Jean-Marc Vanel wrote:
> > The context is that I'm debugging a JSON API with JSON-LD keys and an
> > @context that I recommended .
> >
> > riot from Jena 4.5.0 says :
> > $JENA/bin/riot --syntax=json-ld --verbose --debug
> 78272_pp-absolute.jsonld
> > 09:42:21 ERROR riot            :: There was a problem encountered
> loading a
> > remote context [code=LOADING_REMOTE_CONTEXT_FAILED].
> >
> > but using directly JsonLd.toRdf() succeeds :
> >
> > import com.apicatalog.jsonld._
> > import scala.collection.JavaConverters._
> > val res2 = JsonLd.toRdf("file:/home/jmv/data/
> > grottocenter.org/tests_2022-05-10/78272_pp-absolute.jsonld")
> >    .get() .toList.asScala
> > for ( e <- res2 )
> >      println ( "<" + e.getSubject + "> <" + e.getPredicate + "> " +
> > e.getObject )
> >
> > <_:b0> <http://purl.org/dc/terms/created> 2022-04-14T10:44:18.228Z^^
> > http://www.w3.org/2001/XMLSchema#string
> > <_:b0> <http://purl.org/dc/terms/creator> 3188^^
> > http://www.w3.org/2001/XMLSchema#integer
> > <_:b0> <http://purl.org/dc/terms/spatial> 78272^^
> > http://www.w3.org/2001/XMLSchema#integer
> > <_:b0> <http://www.w3.org/2000/01/rdf-schema#label> Trou de Beget^^
> > http://www.w3.org/2001/XMLSchema#string
> > etc ...
> >
> > I'm afraid that it would not work with Jena API either.
> > As a side question, is there a way to configure riot or Jena API to have
> > (more) verbose JSON-LD error messages, possibly with line numbers.
> > Another side question, it seems that riot no longer accepts HTTP URL's ,
> > only files. Of course , it's easy to use wget or other tools, but that
> was
> > convenient ...
> >
> > The test data are here : http://jmvanel.free.fr/test/?M=D
> >
> > Jean-Marc Vanel
> > <
> http://semantic-forms.cc:1952/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me
> >
> > +33 (0)6 89 16 29 52
> > Twitter: @jmvanel , @jmvanel_fr
> >   Chroniques jardin
> > <
> http://semantic-forms.cc:1952/history?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FChronicle
> >
> >
>

Re: JSON-LD : ERROR with riot, but not with com.apicatalog.jsonld API

Posted by Andy Seaborne <an...@apache.org>.
What version of java are you running? Is it 11.0.14?

Does 78272_pp-absolute.jsonld use a https URL in @context?

You can use --syntax jsonld10 to get jsonld-java.

     Andy

On 11/05/2022 09:12, Jean-Marc Vanel wrote:
> The context is that I'm debugging a JSON API with JSON-LD keys and an
> @context that I recommended .
> 
> riot from Jena 4.5.0 says :
> $JENA/bin/riot --syntax=json-ld --verbose --debug 78272_pp-absolute.jsonld
> 09:42:21 ERROR riot            :: There was a problem encountered loading a
> remote context [code=LOADING_REMOTE_CONTEXT_FAILED].
> 
> but using directly JsonLd.toRdf() succeeds :
> 
> import com.apicatalog.jsonld._
> import scala.collection.JavaConverters._
> val res2 = JsonLd.toRdf("file:/home/jmv/data/
> grottocenter.org/tests_2022-05-10/78272_pp-absolute.jsonld")
>    .get() .toList.asScala
> for ( e <- res2 )
>      println ( "<" + e.getSubject + "> <" + e.getPredicate + "> " +
> e.getObject )
> 
> <_:b0> <http://purl.org/dc/terms/created> 2022-04-14T10:44:18.228Z^^
> http://www.w3.org/2001/XMLSchema#string
> <_:b0> <http://purl.org/dc/terms/creator> 3188^^
> http://www.w3.org/2001/XMLSchema#integer
> <_:b0> <http://purl.org/dc/terms/spatial> 78272^^
> http://www.w3.org/2001/XMLSchema#integer
> <_:b0> <http://www.w3.org/2000/01/rdf-schema#label> Trou de Beget^^
> http://www.w3.org/2001/XMLSchema#string
> etc ...
> 
> I'm afraid that it would not work with Jena API either.
> As a side question, is there a way to configure riot or Jena API to have
> (more) verbose JSON-LD error messages, possibly with line numbers.
> Another side question, it seems that riot no longer accepts HTTP URL's ,
> only files. Of course , it's easy to use wget or other tools, but that was
> convenient ...
> 
> The test data are here : http://jmvanel.free.fr/test/?M=D
> 
> Jean-Marc Vanel
> <http://semantic-forms.cc:1952/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
> +33 (0)6 89 16 29 52
> Twitter: @jmvanel , @jmvanel_fr
>   Chroniques jardin
> <http://semantic-forms.cc:1952/history?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FChronicle>
>