- From: Kingsley Idehen <kidehen@openlinksw.com>
- Date: Tue, 15 Mar 2016 15:37:25 -0400
- To: public-linked-json@w3.org
- Message-ID: <56E86475.4060109@openlinksw.com>
On 3/15/16 3:01 PM, John Walker wrote: > Hi Kingsley, > > On 15 Mar 2016, at 17:21, "Kingsley Idehen" <kidehen@openlinksw.com > <mailto:kidehen@openlinksw.com>> wrote: > >> On 3/15/16 11:53 AM, John Walker wrote: >>> Hi Jean-Claude, >>> >>> Try using the CONSTRUCT form of SPARQL and use Accept header to >>> request results in JSON-LD. >>> >>> prefix schema: <http://schema.org/> >>> construct where { >>> ?p a schema:Place . >>> ?p rdfs:label ?name . >>> ?p geo:lat ?lat . >>> ?p geo:long ?lon . >>> } >>> LIMIT 5 >>> >>> Regards, >>> John >> >> Hi John, >> >> As per my earlier comment, the following will do: >> >> prefix schema: <http://schema.org/> >> *describe ?p* where { >> ?p a schema:Place . >> ?p rdfs:label ?name . >> ?p geo:lat ?lat . >> ?p geo:long ?lon . >> } >> LIMIT 5 > > Sure, but you may also get a bunch of extra data you don't want/need. Yes, and in that case you can ultimately resort to a CONSTRUCT query. I offered DESCRIBE because it let's the user get a feel for how entity descriptions are represented before diving deeper into a more specific CONSTRUCT query > > Main point is to use a query that returns a graph response rather than > a table. Yes. Kingsley >> >> SPARQL Query Editor Source Code Link: >> >> >> curl -i >> "http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&qtxt=prefix+schema%3A+%3Chttp%3A%2F%2Fschema.org%2F%3E%0D%0Adescribe++%3Fp++where+%7B%0D%0A%3Fp+a+schema%3APlace+.%0D%0A%3Fp+rdfs%3Alabel+%3Fname+.%0D%0A%3Fp+geo%3Alat+%3Flat+.%0D%0A%3Fp+geo%3Along+%3Flon+.%0D%0A%7D+LIMIT+5&format=application%2Fld%2Bjson&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on" >> >> >> Kingsley >>> >>> On 15 Mar 2016, at 14:35, "Jean-Claude Moissinac" >>> <jean-claude.moissinac@telecom-paristech.fr> wrote: >>> >>>> 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> >>>> >>>> >> >> >> -- >> Regards, >> >> Kingsley Idehen >> Founder & CEO >> OpenLink Software >> Company Web: http://www.openlinksw.com >> Personal Weblog 1: http://kidehen.blogspot.com >> Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen >> Twitter Profile: https://twitter.com/kidehen >> Google+ Profile: https://plus.google.com/+KingsleyIdehen/about >> LinkedIn Profile: http://www.linkedin.com/in/kidehen >> Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this -- Regards, Kingsley Idehen Founder & CEO OpenLink Software Company Web: http://www.openlinksw.com Personal Weblog 1: http://kidehen.blogspot.com Personal Weblog 2: http://www.openlinksw.com/blog/~kidehen Twitter Profile: https://twitter.com/kidehen Google+ Profile: https://plus.google.com/+KingsleyIdehen/about LinkedIn Profile: http://www.linkedin.com/in/kidehen Personal WebID: http://kingsley.idehen.net/dataspace/person/kidehen#this
Attachments
- application/pkcs7-signature attachment: S/MIME Cryptographic Signature
Received on Tuesday, 15 March 2016 19:37:49 UTC