You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Laura Morales <la...@mail.com> on 2017/10/07 09:27:22 UTC

Change DESCRIBE @context

When I query Fuseki like this "DESCRIBE <> FROM <>" and return a JSON-LD, it looks like the "@context" is generated automatically and it ignores any "PREFIX" declaration.
For example if I have "PREFIX foo: <http://example.org/vocab/Person>" it will create the property "Person" instead of "foo:Person".

Is there any way that I can tweak my DESCRIBE query to return properties as "foo:Person" instead of the automatically generated "Person"?

Re: problems with uploading data in nt.gz format from browser

Posted by Andy Seaborne <an...@apache.org>.
In addition to Rob's point about multiple file in one GZ file...

What does the Fuseki log say?

Can you unload the NT file uncompressed?

How are you uploading the nt.gz file?

     Andy

On 17/10/17 05:15, Rob Vesse wrote:
> Do you know how the original GZip archive was generated?
> 
> Jena uses the standard JDK GZip support to read GZip archives. The JDK doesn’t support the case where multiple separate GZip streams are concatenated into a single file. Therefore, if the archive was created in that way Jena might only read the first stream from the archive and ignore the subsequent streams.
> 
> Extracting with rapper probably uses the OS gzip directly or a library implementation of it which does handle this concatentation
> 
>   Is this a file you could share somehow?
> 
> Rob
> 
> On 17/10/2017 03:55, "Andrew U. Frank" <fr...@geoinfo.tuwien.ac.at> wrote:
> 
>      i experience a strange effect (replicated a few times):
>      i upload data in nt.gz format and get a success message, but only a part
>      (sometimes less than 10%) are uploaded.
>      if i extract the nt file from gz.nt and then convert with rapper to
>      turtle format, i get an information on how many tripels are in the nt.gz
>      file and when i then upload the ttl file all triples are loaded.
>      i use the browser upload.
>      
>      any explanation? i use fuseki 3.4.0.
>      
>      thank you!
>      andrew
>      
>      
> 
> 
> 
> 

Re: problems with uploading data in nt.gz format from browser

Posted by Rob Vesse <rv...@dotnetrdf.org>.
Do you know how the original GZip archive was generated?

Jena uses the standard JDK GZip support to read GZip archives. The JDK doesn’t support the case where multiple separate GZip streams are concatenated into a single file. Therefore, if the archive was created in that way Jena might only read the first stream from the archive and ignore the subsequent streams.

Extracting with rapper probably uses the OS gzip directly or a library implementation of it which does handle this concatentation

 Is this a file you could share somehow?

Rob

On 17/10/2017 03:55, "Andrew U. Frank" <fr...@geoinfo.tuwien.ac.at> wrote:

    i experience a strange effect (replicated a few times):
    i upload data in nt.gz format and get a success message, but only a part 
    (sometimes less than 10%) are uploaded.
    if i extract the nt file from gz.nt and then convert with rapper to 
    turtle format, i get an information on how many tripels are in the nt.gz 
    file and when i then upload the ttl file all triples are loaded.
    i use the browser upload.
    
    any explanation? i use fuseki 3.4.0.
    
    thank you!
    andrew
    
    





problems with uploading data in nt.gz format from browser

Posted by "Andrew U. Frank" <fr...@geoinfo.tuwien.ac.at>.
i experience a strange effect (replicated a few times):
i upload data in nt.gz format and get a success message, but only a part 
(sometimes less than 10%) are uploaded.
if i extract the nt file from gz.nt and then convert with rapper to 
turtle format, i get an information on how many tripels are in the nt.gz 
file and when i then upload the ttl file all triples are loaded.
i use the browser upload.

any explanation? i use fuseki 3.4.0.

thank you!
andrew


Re: Change DESCRIBE @context

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

On 08/10/17 09:40, Laura Morales wrote:
>> Note: the json-ld writer is from a different project. Fuseki isn't doing
>> anything for JSON-LD except passing it to the writer with the same
>> information that is available with Turtle or any other syntax.
> 
> Which 3rd-party library is Fuseki using to generate JSON-LD output? Maybe I can get in touch with them.
> 

com.github.jsonld-java::jsonld-java

Version details of dependencies are in the POM for jena-project:

http://central.maven.org/maven2/org/apache/jena/jena-project/3.4.0/jena-project-3.4.0.pom

     Andy

Re: Change DESCRIBE @context

Posted by Laura Morales <la...@mail.com>.
> Note: the json-ld writer is from a different project. Fuseki isn't doing
> anything for JSON-LD except passing it to the writer with the same
> information that is available with Turtle or any other syntax.

Which 3rd-party library is Fuseki using to generate JSON-LD output? Maybe I can get in touch with them.

Re: Change DESCRIBE @context

Posted by aj...@apache.org.
I don't think there's a per-query ability for that for the same reason as before-- JSON-LD hasn't described a way to 
signal that kind of preference via HTTP.


ajs6f

Laura Morales wrote on 10/8/17 4:58 AM:
> By the way, I was looking at the examples... and I was wondering... Since Jena seems to support JSON-LD output in various formats ("compacted", "expanded", "flattened"), can this behavior be controlled from Fuseki? Either per-query, or maybe with some global setting? Or can I only change the output format if I use Jena with Java through the "RDFDataMgr" class?
>
>
> Sent: Saturday, October 07, 2017 at 5:44 PM
> From: "Andy Seaborne" <an...@apache.org>
> To: users@jena.apache.org
> Subject: Re: Change DESCRIBE @context
> Try to get it working locally - read and write a file to get it in th
> format you want.
>
> https://jena.apache.org/documentation/io/rdf-output.html#json-ld
>
> and the example:
>
> https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java[https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java]
>
> It is a long path through Fuseki so its hard to see which code is doing
> what.
>
> Note: the json-ld writer is from a different project. Fuseki isn't doing
> anything for JSON-LD except passing it to the writer with the same
> information that is available with Turtle or any other syntax.
>
> Andy
>

Re: Change DESCRIBE @context

Posted by Laura Morales <la...@mail.com>.
By the way, I was looking at the examples... and I was wondering... Since Jena seems to support JSON-LD output in various formats ("compacted", "expanded", "flattened"), can this behavior be controlled from Fuseki? Either per-query, or maybe with some global setting? Or can I only change the output format if I use Jena with Java through the "RDFDataMgr" class?


Sent: Saturday, October 07, 2017 at 5:44 PM
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Subject: Re: Change DESCRIBE @context
Try to get it working locally - read and write a file to get it in th
format you want.

https://jena.apache.org/documentation/io/rdf-output.html#json-ld

and the example:

https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java[https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java]

It is a long path through Fuseki so its hard to see which code is doing
what.

Note: the json-ld writer is from a different project. Fuseki isn't doing
anything for JSON-LD except passing it to the writer with the same
information that is available with Turtle or any other syntax.

Andy

Re: Change DESCRIBE @context

Posted by Andy Seaborne <an...@apache.org>.
Try to get it working locally - read and write a file to get it in th 
format you want.

https://jena.apache.org/documentation/io/rdf-output.html#json-ld

   and the example:

https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExJsonLD.java

It is a long path through Fuseki so its hard to see which code is doing 
what.

Note: the json-ld writer is from a different project. Fuseki isn't doing 
anything for JSON-LD except passing it to the writer with the same 
information that is available with Turtle or any other syntax.

     Andy

On 07/10/17 16:24, Laura Morales wrote:
> Not talking about proposing Fuseki a context/frame. I'm OK with a auto-generated context. But Fuseki is creating a new prefix for every URI (see previous email). Rather than creating 100s of new prefixes, it would be more useful if Fuseki would reuse the same PREFIXes that were already specified with my query. To see what I mean, send a DESCRIBE query and compare the Turtle and JSON-LD outputs. If my query was
> 
>      PREFIX ex: <http://example.org/vocab/>
>      DESCRIBE ...
>      FROM ...
> 
> Turtle will return predicates such as
> 
>      <ex:name> "My name"

then the data has a URI <ex:name> in it.

> 
> whereas JSON-LD will return
> 
>      <name> "My name"
> 
> because it creates a new prefix (in the context) called
> 
>      "name": "http://example.com/vocab/name"
> 
> I'm just asking that even the JSON-LD output uses the user defined PREFIXes as does Turtle.
> 
> Makes sense? Please let me know if I wasn't clear.
> 
> 
> 
> 
> Sent: Saturday, October 07, 2017 at 4:49 PM
> From: ajs6f@apache.org
> To: users@jena.apache.org
> Subject: Re: Change DESCRIBE @context
> There's no way (as far as I know) right now to propose a particular context (or other profile information) via HTTP when
> accepting JSON-LD:
> 
> https://github.com/json-ld/json-ld.org/issues/491
> 
> Or is your expectation that Jena would somehow figure out to do what you want unhinted? If you can define a very clear
> and specific algorithm by which Jena could conservatively guess at the right way to build a @context, it might be
> implementable.
> 
> 
> ajs6f
> 

Re: Change DESCRIBE @context

Posted by Laura Morales <la...@mail.com>.
Not talking about proposing Fuseki a context/frame. I'm OK with a auto-generated context. But Fuseki is creating a new prefix for every URI (see previous email). Rather than creating 100s of new prefixes, it would be more useful if Fuseki would reuse the same PREFIXes that were already specified with my query. To see what I mean, send a DESCRIBE query and compare the Turtle and JSON-LD outputs. If my query was

    PREFIX ex: <http://example.org/vocab/>
    DESCRIBE ...
    FROM ...

Turtle will return predicates such as

    <ex:name> "My name"

whereas JSON-LD will return

    <name> "My name"

because it creates a new prefix (in the context) called

    "name": "http://example.com/vocab/name"

I'm just asking that even the JSON-LD output uses the user defined PREFIXes as does Turtle.

Makes sense? Please let me know if I wasn't clear.




Sent: Saturday, October 07, 2017 at 4:49 PM
From: ajs6f@apache.org
To: users@jena.apache.org
Subject: Re: Change DESCRIBE @context
There's no way (as far as I know) right now to propose a particular context (or other profile information) via HTTP when
accepting JSON-LD:

https://github.com/json-ld/json-ld.org/issues/491

Or is your expectation that Jena would somehow figure out to do what you want unhinted? If you can define a very clear
and specific algorithm by which Jena could conservatively guess at the right way to build a @context, it might be
implementable.


ajs6f

Re: Change DESCRIBE @context

Posted by aj...@apache.org.
There's no way (as far as I know) right now to propose a particular context (or other profile information) via HTTP when 
accepting JSON-LD:

https://github.com/json-ld/json-ld.org/issues/491

Or is your expectation that Jena would somehow figure out to do what you want unhinted? If you can define a very clear 
and specific algorithm by which Jena could conservatively guess at the right way to build a @context, it might be 
implementable.


ajs6f

Laura Morales wrote on 10/7/17 10:21 AM:
> The problem is that Fuseki (when I select JSON-LD output format) creates a @context with as many properties as there are URIs. For example
>
>
>   "@context" : {
>     "name" : {
>       "@id" : "example.org/vocab/name",
>       "@type" : ...
>     },
>     "surname" : {
>       "@id" : "example.org/vocab/surname",
>       "@type" : ...
>     },
>     "age" : {
>       "@id" : "example.org/vocab/age",
>       "@type" : ...
>     },
>     "ex": "example.org/vocab/"
>   }
>
>
> whereas all I want is
>
>
>   "@context" : {
>     "ex": "example.org/vocab/"
>   }
>
>
>
>
> Sent: Saturday, October 07, 2017 at 12:37 PM
> From: "Andy Seaborne" <an...@apache.org>
> To: users@jena.apache.org
> Subject: Re: Change DESCRIBE @context
> The result Model from DESCRIBE has the prefixes of the data and the
> query. There can be multiple prefixes for the same URI.
>
> How that gets processed by JSON-LD is another matter and I don't know
> the details.
>
> Andy
>

Re: Change DESCRIBE @context

Posted by Laura Morales <la...@mail.com>.
The problem is that Fuseki (when I select JSON-LD output format) creates a @context with as many properties as there are URIs. For example


  "@context" : {
    "name" : {
      "@id" : "example.org/vocab/name",
      "@type" : ...
    },
    "surname" : {
      "@id" : "example.org/vocab/surname",
      "@type" : ...
    },
    "age" : {
      "@id" : "example.org/vocab/age",
      "@type" : ...
    },
    "ex": "example.org/vocab/"
  }


whereas all I want is


  "@context" : {
    "ex": "example.org/vocab/"
  }




Sent: Saturday, October 07, 2017 at 12:37 PM
From: "Andy Seaborne" <an...@apache.org>
To: users@jena.apache.org
Subject: Re: Change DESCRIBE @context
The result Model from DESCRIBE has the prefixes of the data and the
query. There can be multiple prefixes for the same URI.

How that gets processed by JSON-LD is another matter and I don't know
the details.

Andy

Re: Change DESCRIBE @context

Posted by Andy Seaborne <an...@apache.org>.
The result Model from DESCRIBE has the prefixes of the data and the 
query.  There can be multiple prefixes for the same URI.

How that gets processed by JSON-LD is another matter and I don't know 
the details.

     Andy

On 07/10/17 10:27, Laura Morales wrote:
> When I query Fuseki like this "DESCRIBE <> FROM <>" and return a JSON-LD, it looks like the "@context" is generated automatically and it ignores any "PREFIX" declaration.
> For example if I have "PREFIX foo: <http://example.org/vocab/Person>" it will create the property "Person" instead of "foo:Person".
> 
> Is there any way that I can tweak my DESCRIBE query to return properties as "foo:Person" instead of the automatically generated "Person"?
>