Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericmoritz/e7c63a7b137f0df05228 to your computer and use it in GitHub Desktop.
Save ericmoritz/e7c63a7b137f0df05228 to your computer and use it in GitHub Desktop.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>
SELECT ?project ?maintainer WHERE {
?p doap:name ?project .
?p doap:maintainer ?m .
?m foaf:name ?maintainer .
}
$ ~/Projects/rdf/jena/apache-jena-2.12.1/bin/sparql --data http://ldf-server-python.herokuapp.com/ --query example.sparql
--------------------------------
| project | maintainer |
================================
| "ldf-server" | "Eric Moritz" |
--------------------------------
$ time ./node_modules/ldf-client/bin/ldf-client http://ldf-server-python.herokuapp.com/ example.sparql -l debug
[Thu Nov 20 2014 01:23:19 GMT-0500 (EST)] INFO HttpClient Retrieving http://ldf-server-python.herokuapp.com/
[[Thu Nov 20 2014 01:23:19 GMT-0500 (EST)] INFO HttpClient Retrieving http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname
[Thu Nov 20 2014 01:23:19 GMT-0500 (EST)] INFO HttpClient Retrieving http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fusefulinc.com%2Fns%2Fdoap%23name
[Thu Nov 20 2014 01:23:19 GMT-0500 (EST)] INFO HttpClient Retrieving http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fusefulinc.com%2Fns%2Fdoap%23maintainer
real 0m0.382s
user 0m0.240s
sys 0m0.041s
@RubenVerborgh
Copy link

Hi @ericmoritz,

Thanks for starting this!

The reason the LDF client does not give a result, is that the triple pattern fragments are not yet complete.
Triple Pattern Fragments consist of data, metadata, and controls.

As we can see from the debug log above, the controls are working: the client is able to retrieve other fragments from the start fragment. However, the metadata—which is necessary for the client to execute queries efficiently—is missing:

$ curl 'http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname'
@prefix ns1: <http://www.w3.org/ns/hydra/core#> .
@prefix ns2: <http://xmlns.com/foaf/0.1/> .
@prefix ns3: <http://rdfs.org/ns/void#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://eric.themoritzfamily.com/> ns2:name "Eric Moritz" .

<http://ldf-server-python.herokuapp.com/#dataset> a ns3:Dataset,
        ns1:Collection ;
    ns3:subset <http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname> ;
    ns1:search [ ns1:mapping [ ns1:property rdf:predicate ;
                    ns1:variable "p" ],
                [ ns1:property rdf:object ;
                    ns1:variable "o" ],
                [ ns1:property rdf:subject ;
                    ns1:variable "s" ] ;
            ns1:template "http://ldf-server-python.herokuapp.com/{?s,p,o}" ] .

We need a triple such as the following:

<http://ldf-server-python.herokuapp.com/?p=http%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname> void:triples 1.

Note that this count does not have to be exact; an approximation is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment