You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Mikael Pesonen <mi...@lingsoft.fi> on 2018/01/03 10:23:20 UTC
Getting JSON+LS with GSP
Hi,
I'm making a simple query
SELECT * WHERE {
GRAPH ?g
{
<https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
}
}';
Everything is fine when requesting application/sparql-results+json or
text/plain, for example.
But for application/ld+json I'm getting application/sparql-results+json
also. What am I doing wrong?
Thanks
--
Lingsoft - 30 years of Leading Language Management
www.lingsoft.fi
Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
Mikael Pesonen
System Engineer
e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300
Time zone: GMT+2
Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND
Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND
Re: Getting JSON+LS with GSP
Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
SPARQL CONSTRUCT returns just a set of triples, thus, the SPARQL
standard doesn't guarantee any ordering. That said, anything beyond
depends on the implementation of the serialization, maybe by chance some
parts are ordered, maybe not.
On 04.01.2018 15:25, Mikael Pesonen wrote:
>
> Thanks, got it working now!
>
> This is not Jena related anymore, but any tip how to create an ordered
> list in JSON-LD format? CONSTRUCT just serializes triplets in
> unordered fashion.
> So I would like JSON-LD contain the results in the same order as with
> SPARQL ORDER BY.
>
> Mikael
>
>
> On 3.1.2018 12:27, Andy Seaborne wrote:
>> JSON-LD is an RDF serialization, and not a SPARQL result set
>> serialization.
>>
>> Make a CONSTRUCT query.
>>
>> Andy
>>
>> On 03/01/18 10:23, Mikael Pesonen wrote:
>>>
>>> Hi,
>>>
>>> I'm making a simple query
>>>
>>> SELECT * WHERE {
>>> GRAPH ?g
>>> {
>>> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
>>> }
>>> }';
>>>
>>> Everything is fine when requesting application/sparql-results+json
>>> or text/plain, for example.
>>>
>>> But for application/ld+json I'm getting
>>> application/sparql-results+json also. What am I doing wrong?
>>>
>>> Thanks
>>>
>
Re: Getting JSON+LS with GSP
Posted by Mikael Pesonen <mi...@lingsoft.fi>.
After playing in JSON-LD playground, it seems that correct way to add
list notation is
Jena output:
{
"@graph" : [
item1,
item2
]
}
Added list:
{
"@graph" : { "@list:": [
item1,
item2
]
}}
Could anyone confirm this is the correct way to do it?
Thanks
On 4.1.2018 21:28, James Anderson wrote:
> good evening,
>
>> On 2018-01-04, at 15:25, Mikael Pesonen <mi...@lingsoft.fi> wrote:
>>
>>
>> Thanks, got it working now!
>>
>> This is not Jena related anymore, but any tip how to create an ordered list in JSON-LD format? CONSTRUCT just serializes triplets in unordered fashion.
>> So I would like JSON-LD contain the results in the same order as with SPARQL ORDER BY.
> depending on your json-ld encoding, it may have its own ordering rules.
>
>> Mikael
>>
>>
>> On 3.1.2018 12:27, Andy Seaborne wrote:
>>> JSON-LD is an RDF serialization, and not a SPARQL result set serialization.
>>>
>>> Make a CONSTRUCT query.
>>>
>>> Andy
>>>
>>> On 03/01/18 10:23, Mikael Pesonen wrote:
>>>> Hi,
>>>>
>>>> I'm making a simple query
>>>>
>>>> SELECT * WHERE {
>>>> GRAPH ?g
>>>> {
>>>> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
>>>> }
>>>> }';
>>>>
>>>> Everything is fine when requesting application/sparql-results+json or text/plain, for example.
>>>>
>>>> But for application/ld+json I'm getting application/sparql-results+json also. What am I doing wrong?
>>>>
>>>> Thanks
>>>>
>> --
>> Lingsoft - 30 years of Leading Language Management
>>
>> www.lingsoft.fi
>>
>> Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
>>
>> Mikael Pesonen
>> System Engineer
>>
>> e-mail: mikael.pesonen@lingsoft.fi
>> Tel. +358 2 279 3300
>>
>> Time zone: GMT+2
>>
>> Helsinki Office
>> Eteläranta 10
>> FI-00130 Helsinki
>> FINLAND
>>
>> Turku Office
>> Kauppiaskatu 5 A
>> FI-20100 Turku
>> FINLAND
>>
--
Lingsoft - 30 years of Leading Language Management
www.lingsoft.fi
Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
Mikael Pesonen
System Engineer
e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300
Time zone: GMT+2
Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND
Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND
Re: Getting JSON+LS with GSP
Posted by Mikael Pesonen <mi...@lingsoft.fi>.
Hi,
so the best way to achieve ordering is to export JSON-LD and reorder the
result array in Jena client code and add "@list": true to context.
Mikael
On 4.1.2018 21:28, James Anderson wrote:
> good evening,
>
>> On 2018-01-04, at 15:25, Mikael Pesonen <mi...@lingsoft.fi> wrote:
>>
>>
>> Thanks, got it working now!
>>
>> This is not Jena related anymore, but any tip how to create an ordered list in JSON-LD format? CONSTRUCT just serializes triplets in unordered fashion.
>> So I would like JSON-LD contain the results in the same order as with SPARQL ORDER BY.
> depending on your json-ld encoding, it may have its own ordering rules.
>
>> Mikael
>>
>>
>> On 3.1.2018 12:27, Andy Seaborne wrote:
>>> JSON-LD is an RDF serialization, and not a SPARQL result set serialization.
>>>
>>> Make a CONSTRUCT query.
>>>
>>> Andy
>>>
>>> On 03/01/18 10:23, Mikael Pesonen wrote:
>>>> Hi,
>>>>
>>>> I'm making a simple query
>>>>
>>>> SELECT * WHERE {
>>>> GRAPH ?g
>>>> {
>>>> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
>>>> }
>>>> }';
>>>>
>>>> Everything is fine when requesting application/sparql-results+json or text/plain, for example.
>>>>
>>>> But for application/ld+json I'm getting application/sparql-results+json also. What am I doing wrong?
>>>>
>>>> Thanks
>>>>
>> --
>> Lingsoft - 30 years of Leading Language Management
>>
>> www.lingsoft.fi
>>
>> Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
>>
>> Mikael Pesonen
>> System Engineer
>>
>> e-mail: mikael.pesonen@lingsoft.fi
>> Tel. +358 2 279 3300
>>
>> Time zone: GMT+2
>>
>> Helsinki Office
>> Eteläranta 10
>> FI-00130 Helsinki
>> FINLAND
>>
>> Turku Office
>> Kauppiaskatu 5 A
>> FI-20100 Turku
>> FINLAND
>>
--
Lingsoft - 30 years of Leading Language Management
www.lingsoft.fi
Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
Mikael Pesonen
System Engineer
e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300
Time zone: GMT+2
Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND
Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND
Re: Getting JSON+LS with GSP
Posted by James Anderson <an...@gmail.com>.
good evening,
> On 2018-01-04, at 15:25, Mikael Pesonen <mi...@lingsoft.fi> wrote:
>
>
> Thanks, got it working now!
>
> This is not Jena related anymore, but any tip how to create an ordered list in JSON-LD format? CONSTRUCT just serializes triplets in unordered fashion.
> So I would like JSON-LD contain the results in the same order as with SPARQL ORDER BY.
depending on your json-ld encoding, it may have its own ordering rules.
>
> Mikael
>
>
> On 3.1.2018 12:27, Andy Seaborne wrote:
>> JSON-LD is an RDF serialization, and not a SPARQL result set serialization.
>>
>> Make a CONSTRUCT query.
>>
>> Andy
>>
>> On 03/01/18 10:23, Mikael Pesonen wrote:
>>>
>>> Hi,
>>>
>>> I'm making a simple query
>>>
>>> SELECT * WHERE {
>>> GRAPH ?g
>>> {
>>> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
>>> }
>>> }';
>>>
>>> Everything is fine when requesting application/sparql-results+json or text/plain, for example.
>>>
>>> But for application/ld+json I'm getting application/sparql-results+json also. What am I doing wrong?
>>>
>>> Thanks
>>>
>
> --
> Lingsoft - 30 years of Leading Language Management
>
> www.lingsoft.fi
>
> Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
>
> Mikael Pesonen
> System Engineer
>
> e-mail: mikael.pesonen@lingsoft.fi
> Tel. +358 2 279 3300
>
> Time zone: GMT+2
>
> Helsinki Office
> Eteläranta 10
> FI-00130 Helsinki
> FINLAND
>
> Turku Office
> Kauppiaskatu 5 A
> FI-20100 Turku
> FINLAND
>
Re: Getting JSON+LS with GSP
Posted by Mikael Pesonen <mi...@lingsoft.fi>.
Thanks, got it working now!
This is not Jena related anymore, but any tip how to create an ordered
list in JSON-LD format? CONSTRUCT just serializes triplets in unordered
fashion.
So I would like JSON-LD contain the results in the same order as with
SPARQL ORDER BY.
Mikael
On 3.1.2018 12:27, Andy Seaborne wrote:
> JSON-LD is an RDF serialization, and not a SPARQL result set
> serialization.
>
> Make a CONSTRUCT query.
>
> Andy
>
> On 03/01/18 10:23, Mikael Pesonen wrote:
>>
>> Hi,
>>
>> I'm making a simple query
>>
>> SELECT * WHERE {
>> GRAPH ?g
>> {
>> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
>> }
>> }';
>>
>> Everything is fine when requesting application/sparql-results+json or
>> text/plain, for example.
>>
>> But for application/ld+json I'm getting
>> application/sparql-results+json also. What am I doing wrong?
>>
>> Thanks
>>
--
Lingsoft - 30 years of Leading Language Management
www.lingsoft.fi
Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books
Mikael Pesonen
System Engineer
e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300
Time zone: GMT+2
Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND
Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND
Re: Getting JSON+LS with GSP
Posted by Andy Seaborne <an...@apache.org>.
JSON-LD is an RDF serialization, and not a SPARQL result set serialization.
Make a CONSTRUCT query.
Andy
On 03/01/18 10:23, Mikael Pesonen wrote:
>
> Hi,
>
> I'm making a simple query
>
> SELECT * WHERE {
> GRAPH ?g
> {
> <https://.../9f6c495c-1f99-4f0e-b089-2825282f280e> ?p ?o
> }
> }';
>
> Everything is fine when requesting application/sparql-results+json or
> text/plain, for example.
>
> But for application/ld+json I'm getting application/sparql-results+json
> also. What am I doing wrong?
>
> Thanks
>