public class SPARQL extends Object
| Modifier and Type | Field and Description |
|---|---|
private org.slf4j.Logger |
log |
org.aksw.jena_sparql_api.core.QueryExecutionFactory |
qef |
private long |
timeToLive |
| Constructor and Description |
|---|
SPARQL()
SPARQLEndpoints.DBPEDIA_ORG as endpoint used. |
SPARQL(String endpoint) |
| Modifier and Type | Method and Description |
|---|---|
static Set<String> |
extractAnswerStrings(Set<org.apache.jena.rdf.model.RDFNode> answers)
For use with
sparql(String) Extracts answer strings. |
long |
getCacheTimeToLive() |
static boolean |
isValidSparqlQuery(String sparql)
Tries to parse query with apache.jena .
|
static void |
main(String[] args) |
void |
setCacheTimeToLive(long timeToLive) |
Set<org.apache.jena.rdf.model.RDFNode> |
sparql(String query)
Fire a sparql query against endpoint defined in constructor.
|
private org.slf4j.Logger log
public org.aksw.jena_sparql_api.core.QueryExecutionFactory qef
private long timeToLive
public SPARQL()
SPARQLEndpoints.DBPEDIA_ORG as endpoint used.public SPARQL(String endpoint)
endpoint - - A sparql endpoint, e.g. SPARQLEndpoints.DBPEDIA_ORGpublic Set<org.apache.jena.rdf.model.RDFNode> sparql(String query) throws ExecutionException
NOTE: This will block. To set a maximum execution time, use ThreadedSPARQL
For string representation of answers, see extractAnswerStrings(Set)
query - - a sparql queryExecutionExceptionpublic static Set<String> extractAnswerStrings(Set<org.apache.jena.rdf.model.RDFNode> answers)
sparql(String) Extracts answer strings. Can be directly set as golden answers in IQuesion.answers - public long getCacheTimeToLive()
public void setCacheTimeToLive(long timeToLive)
public static boolean isValidSparqlQuery(String sparql)
sparql - Copyright © 2016–2019. All rights reserved.