W3C home > Mailing lists > Public > public-linked-json@w3.org > March 2016

json-ld and sparql

From: Jean-Claude Moissinac <jean-claude.moissinac@telecom-paristech.fr>
Date: Tue, 15 Mar 2016 14:33:24 +0100
Message-ID: <CAP8HVi2VtEKGXt8NiYV6QivxS4wqZFGN7DwDKVBekUbbLc3_OQ@mail.gmail.com>
To: public-linked-json@w3.org
I'm trying to find best practices in the use of a json output from a sparql
endpoint
For exemple the request on dbpedia :
prefix schema: <http://schema.org/>
select distinct ?p ?name ?lat ?lon where {
?p a schema:Place .
?p rdfs:label ?name .
?p geo:lat ?lat .
?p geo:long ?lon .
} LIMIT 5
give me as json output

{ "head": { "link": [], "vars": ["p", "name", "lat", "lon"] },
  "results": { "distinct": false, "ordered": true, "bindings": [
    { "p": { "type": "uri", "value":
"http://dbpedia.org/resource/Cameron_Parish,_Louisiana" }	, "name": {
"type": "literal", "xml:lang": "en", "value": "Cameron Parish,
Louisiana" }	, "lat": { "type": "typed-literal", "datatype":
"http://www.w3.org/2001/XMLSchema#float", "value": "29.85" }	, "lon":
{ "type": "typed-literal", "datatype":
"http://www.w3.org/2001/XMLSchema#float", "value": "-93.2" }},
    { "p": { "type": "uri", "value":
"http://dbpedia.org/resource/Cameron_Parish,_Louisiana" }	, "name": {
"type": "literal", "xml:lang": "ar", "value":
"\u0645\u0642\u0627\u0637\u0639\u0629
\u0643\u0627\u0645\u064A\u0631\u0648\u0646
(\u0644\u0648\u064A\u0632\u064A\u0627\u0646\u0627)" }	, "lat": {
"type": "typed-literal", "datatype":
"http://www.w3.org/2001/XMLSchema#float", "value": "29.85" }	, "lon":
{ "type": "typed-literal", "datatype":
"http://www.w3.org/2001/XMLSchema#float", "value": "-93.2" }},
... < cut for clarity >

 }} ] } }

We loose the fact that ?p is a Place. We can factorize the 'type' on the
table of results. And finally get a table of objects like thos one
{
    "p ":  "http://dbpedia.org/resource/Cameron_Parish,_Louisiana",
"name": "Cameron Parish, Louisiana",
"pos": { "lat": 29.85, "long": 93.2 }
}

I suppose some results can be obtained by using a context and some others
by framing.

Can we point me on ideas for clarification?

Many thanks in advance

--
Jean-Claude Moissinac


Cet e-mail a été envoyé depuis un ordinateur protégé par Avast.
www.avast.com
<https://www.avast.com/fr-fr/lp-safe-emailing?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=OA-2109-A>
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Received on Tuesday, 15 March 2016 13:34:17 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:47 UTC