Sending SPARQL queries to Fuseki - sparql

I have queries like this.
SELECT * WHERE{
SERVICE <endpoint 1>{
SELECT ?country ?port
WHERE {?port <country> ?country}
}
SERVICE <endpoint 2>{
SELECT ?ship ?name ?country
WHERE {?ship <flagoftheship> ?country.
?ship <vesselname> ?name
}
}
}
and i'm developing a frontend to send queries like that (can have several endpoints, the user may even provide it's own endpoint URL) to a Fuseki Server, i've been using the Fuseki frontend that hosts over port 3030 when you run the Server but i want to know how can i actually send those queries from my own app, do i need to execute a cmd command? (using a server that receives the query from the javascript app and then runs the command)
EDIT: pretty much i need to know what does the Fuseki frontend when you click the "play" button so that the server gets the query that you put in the textbox

Fuseki implements the SPARQL 1.1 Protocol which gives several ways of submitting a query to a SPARQL endpoint. The simplest is probably the HTTP GET with the query url-encoded as a parameter named query.

Related

SPARQL over HTTP not executing

I am using the SOH commands given by apache jena fuseki platform to s-get and s-post and s-query but I am always getting the output as s-get : command not found. What is wrong in this case and how can I make this work?

How can I do to reconcile AGROVOC sparql endpoint with OpenRefine

Having this sparql service available http://agrovoc.uniroma2.it/sparql, using the OpenRefine RDF extension, is it possible to use it as a reconciliation service?
So far I've tried but got the following error:
12:06:51.461 [..ctReconciliationService] error reconciling 'Lenteja'
(3153ms) org.shaded.apache.jena.query.QueryException: Endpoint
returned Content-Type: text/html which is not rcognized for SELECT
queries
I think may be I got the wrong endpoint.
OpenRefine version is 3.3

Graphdb sparql cannot make federated query

I am trying to make a federated query using my local GraphDB database and SPARQL endpoint. For some reason I always get errors or empty columns in my result table.
I tried several SPARQL endpoints which are working perfectly fine on FactForge. My code and error message are below can you help me to get it working.
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bif: <bif:>
SELECT ?duration1 ?duration2{
VALUES (?start ?end)
{("2011-02-02T14:45:14"^^xsd:dateTime "2011-02-04T14:45:13"^^xsd:dateTime)}
SERVICE <http://dbpedia.org/sparql> #-- Virtuoso
{ BIND ((?end - ?start)/86400.0 AS ?duration1) }
}
Error 500: error
Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: Virtuoso 22023 Error Can not load own service description
I am using the free version of GraphDB. My OS is macOS Mojave 10.14.5. I directly installed GraphDB from the website and i never used RDF4J before. Also after this error i installed a local Virtuoso SPARQL endpoint and i can use federated query from that endpoint using my local GraphDB as a service. But i cannot use federated query from my local GraphDB endpoint using my local Virtuoso endpoint as a service since it gives the same error above.
The root cause of the above error is "Virtuoso 22023 Error Can not load own service description", which is handled as an unknown runtime exception resulting HTTP Code 500.
I suspect this was a temporal glitch in the DBPedia service since the same query currently works from GraphDB tested with the latest GraphDB 9.0 versions and an older GraphDB 8.x version via FactForge service.

Query and Graph are not found Fuseki Info [108] 400 Error

I am running query from the live demo (http://biohackathon.org/d3sparql/). The SPARQL endpoint is changed to the localhost endpoint built using Apache Jena Fuseki server. The RDF file is uploaded and stored in the server and the SPARQL endpoint is set. The set up for making the RDF file accessible via HTTP is basically a success and changes could be tracked through terminal.
So, I am trying to implement D3Sparkle to visualise the data. All I did so far is changing the endpoint and put my SPARQL query respectively in the D3Sparkle live demo page. However, when I try running the query, it I got this error:
[2017-02-25 00:05:30] Fuseki INFO [108] GET /ds :: 'data' :: <none> ? query=PREFIX%20up%3A%20%3Chttp%3A%2F%2Fpurl.uniprot.org%2Fcore%2F%3E%0APREFIX%20tax%3A%20%3Chttp%3A%2F%2Fpurl.uniprot.org%2Ftaxonomy%2F%3E%0ASELECT%20%3Froot_name%20%3Fparent_name%20%3Fchild_name%0AFROM%20%3Chttp%3A%2F%2Ftogogenome.org%2Fgraph%2Funiprot%3E%0AWHERE%0A%7B%0A%20%20VALUES%20%3Froot_name%20%7B%20%22Tardigrada%22%20%7D%0A%20%20%3Froot%20up%3AscientificName%20%3Froot_name%20.%0A%20%20%3Fchild%20rdfs%3AsubClassOf%2B%20%3Froot%20.%0A%20%20%3Fchild%20rdfs%3AsubClassOf%20%3Fparent%20.%0A%20%20%3Fchild%20up%3AscientificName%20%3Fchild_name%20.%0A%20%20%3Fparent%20up%3AscientificName%20%3Fparent_name%20.%0A%7D%0A%20%20%20%20%20%20
[2017-02-25 00:05:30] Fuseki INFO [108] 400 Neither ?default nor ?graph in the query string of the request (0 ms)
Does anybody had the same experience or any advices?
Thank you in advance for your help.
The request is not directed to the query endpoint. Usually that's /ds/sparql or /ds/query.
It is going to /ds/data which is the default for SPARQL Graph Store Protocol (GSP) operations.
The error is from the GSP handler.

How to restart listening Twitter straming Api Again?

I'm using Twitter4j to get Tweets real time via. Twitter streaming API and it is working fine . Sometime it throws Exception due to network connecting issue(or some other reason) which is also OK to me however I'm not able to recover from this condition & it require server restart . Can someone please suggest how to restart listening Twitter straming Api Again without server restart . We have TwitterStreamFactory & TwitterStream class in Twitter4j. Many thanks in advance .
You should create a handler for such exceptions and in it create a loop that tries to start listening a few times before erroring out.