To exclude complications from the Jena API, could you try the SERVICE
keyword instead of ExecutionFactory.sparqlService? I.e. what happens if
you run a query such as
SELECT *
WHERE {
SERVICE <http://localhost:8083/tbl/sparql> {
GRAPH <http://topbraid.org/examples/kennedys> {
?a ?b ?c
}
}
}
Holger
On 3/5/2015 2:48, Jack Hodges wrote:
Holger,
You and others on the TQ staff have suggested that I use TBL as my
SPARQL endpoint and that is a great suggestion. I have created an
Eclipse project that uses the Jena library to make a restful call to
the local TBL instance. The endpoint and query to are:
endpoint:
http://localhost:8083/tbl/sparql
query:
prefix sp: <http://spinrdf.org/sp%23> prefix afn:
<http://jena.hpl.hp.com/ARQ/function%23> prefix fn:
<http://www.w3.org/2005/xpath-functions%23> prefix rdfs:
<http://www.w3.org/2000/01/rdf-schema%23> prefix quantity:
<http://qudt.org/vocab/quantity%23> prefix skos:
<http://www.w3.org/2004/02/skos/core%23> prefix spin:
<http://spinrdf.org/spin%23> prefix act:
<http://siemens.com/schemas/activity%23>SELECT ?res WHERE {BIND
(act:commonLabelURI("http://developer.runkeeper.com/healthgraph#Spinning")
AS ?res) .}
The Jena code that creates and invokes the query on the sparql
endpoint are:
Query queryobj = QueryFactory.create(mQueryStr);
QueryExecution qe =
QueryExecutionFactory.sparqlService(mEndpointStr, queryobj);
OutputStream baos = new ByteArrayOutputStream();
try {
mResults = qe.execSelect();
ResultSetFormatter.outputAsJSON(baos, mResults);
mResponseStr = baos.toString();
} catch (Exception ex) {
System.out.println(ex.getMessage());
} finally {
qe.close();
}
Once again, this query runs fine in composer. It also works when
called in against TBL in a browser:
http://localhost:8083/tbl/sparql?query=prefix%20sp:%20%3Chttp://spinrdf.org/sp%23%3E%20prefix%20afn:%20%3Chttp://jena.hpl.hp.com/ARQ/function%23%3E%20prefix%20fn:%20%3Chttp://www.w3.org/2005/xpath-functions%23%3E%20prefix%20rdfs:%20%3Chttp://www.w3.org/2000/01/rdf-schema%23%3E%20prefix%20quantity:%20%3Chttp://qudt.org/vocab/quantity%23%3E%20prefix%20skos:%20%3Chttp://www.w3.org/2004/02/skos/core%23%3E%20prefix%20spin:%20%3Chttp://spinrdf.org/spin%23%3E%20prefix%20act:%20%3Chttp://siemens.com/schemas/activity%23%3ESELECT%20?res%20WHERE%20{BIND%20%28act:commonLabelURI%28%22http://strava.github.io/api/v3%23Ride%22%29%20AS%20?res%29%20.}
although it returns the results in XML. When called in the eclipse
projectagainst TBL it returns an empty string
This is what I consider an appropriate use of TBL but it isn't
working. Since you have commented online about the use of the Jena
libraries (albeit for Allegrograph endpoints) it would be most
appreciated if you could comment on what is going on here. Thank you.
Jack
On Thursday, February 26, 2015 at 6:04:15 PM UTC-8, Holger Knublauch
wrote:
Hi Jack,
short answer: You'll need the SPIN API [1] as a plugin to Fuseki.
Fuseki by itself does not know what to do with the RDF
declarations of SPIN functions - they are just triples for Fuseki.
BTW afn:localname is not just a TopBraid function, but is
originally from Jena. So it works in Fuseki, but anything from the
spif: namespace would not work.
A commercial alternative to Fuseki is the TopBraid Live platform
[2], and this has SPIN and TopBraid SPARQL functions built in.
HTH
Holger
[1] http://topbraid.org/spin/api/
[2] http://www.topquadrant.com/products/topbraid-live/
<http://www.topquadrant.com/products/topbraid-live/>
On 2/27/2015 11:00, Jack Hodges wrote:
I have exported a bunch of graphs to a .ttl file and then
imported it into fuseki. If I run a query on fuseki to see if the
functions are there - they are. If I run a query on fuseki to
show the spin:body or spin:constraints they show them as
anonymous objects (is that the correct term?). If I run queries
on the classes and properties that my spin functions are working
on I get the right results. But I cannot get results by executing
my spin functions.
So the classes and properties exist, the bindings exist, the spin
functions exist, the prefixes are defined, but the functions
don't execute. Other functions execute, such as the TopBraid
functions (I tested with afn:localname for example) and they work
fine.
By the way, these functions have been tested in TBCME and work
fine. If I take the strings I am using in fuseki and run them in
the SPARQL window of TBCME they also work fine. I checked the
list of models that are being exported with mine and noted that
some are not exported, such as skos. Is this a problem?
I must be missing something simple here. Any comments?
Jack
--
You received this message because you are subscribed to the
Google Group "TopBraid Suite Users", the topics of which include
Enterprise Vocabulary Network (EVN), Reference Data Manager
(RDM), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
<javascript:>
---
You received this message because you are subscribed to the
Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected] <javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise
Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid
Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web
Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Group "TopBraid
Suite Users", the topics of which include Enterprise Vocabulary Network (EVN),
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.