Package org.aksw.iguana.cc.lang.impl
Class SPARQLLanguageProcessor
- java.lang.Object
-
- org.aksw.iguana.cc.lang.impl.SPARQLLanguageProcessor
-
- All Implemented Interfaces:
LanguageProcessor
@Shorthand("lang.SPARQL") public class SPARQLLanguageProcessor extends java.lang.Object implements LanguageProcessor
SPARQL Language Processor. Tries to analyze Queries as SPARQL queries and checks http response for either application/sparql-results+json or application/sparql-results+xml to count the result size correctly. Otherwise assumes it record per line and counts the returning lines.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
QUERY_RESULT_TYPE_JSON
static java.lang.String
QUERY_RESULT_TYPE_XML
static java.lang.String
XML_RESULT_ELEMENT_NAME
static java.lang.String
XML_RESULT_ROOT_ELEMENT_NAME
-
Constructor Summary
Constructors Constructor Description SPARQLLanguageProcessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.jena.rdf.model.Model
generateTripleStats(java.util.List<QueryWrapper> queries, java.lang.String resourcePrefix, java.lang.String taskID)
Method to generate Triple Statistics for provided queriesstatic java.lang.String
getContentTypeVal(org.apache.http.Header header)
static long
getJsonResultSize(java.lang.String res)
java.lang.String
getQueryPrefix()
Returns the prefix used for the queries (e.g.java.lang.Long
getResultSize(org.apache.http.client.methods.CloseableHttpResponse response)
Gets the result size of a given HTTP responsestatic long
getXmlResultSize(java.lang.String res)
-
-
-
Field Detail
-
XML_RESULT_ELEMENT_NAME
public static final java.lang.String XML_RESULT_ELEMENT_NAME
- See Also:
- Constant Field Values
-
XML_RESULT_ROOT_ELEMENT_NAME
public static final java.lang.String XML_RESULT_ROOT_ELEMENT_NAME
- See Also:
- Constant Field Values
-
QUERY_RESULT_TYPE_JSON
public static final java.lang.String QUERY_RESULT_TYPE_JSON
- See Also:
- Constant Field Values
-
QUERY_RESULT_TYPE_XML
public static final java.lang.String QUERY_RESULT_TYPE_XML
- See Also:
- Constant Field Values
-
-
Method Detail
-
getQueryPrefix
public java.lang.String getQueryPrefix()
Description copied from interface:LanguageProcessor
Returns the prefix used for the queries (e.g. sparql, query or document)- Specified by:
getQueryPrefix
in interfaceLanguageProcessor
- Returns:
-
generateTripleStats
public org.apache.jena.rdf.model.Model generateTripleStats(java.util.List<QueryWrapper> queries, java.lang.String resourcePrefix, java.lang.String taskID)
Description copied from interface:LanguageProcessor
Method to generate Triple Statistics for provided queries- Specified by:
generateTripleStats
in interfaceLanguageProcessor
- Returns:
- Model with the triples to add to the results
-
getContentTypeVal
public static java.lang.String getContentTypeVal(org.apache.http.Header header)
-
getJsonResultSize
public static long getJsonResultSize(java.lang.String res) throws org.json.simple.parser.ParseException
- Throws:
org.json.simple.parser.ParseException
-
getXmlResultSize
public static long getXmlResultSize(java.lang.String res) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
- Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
-
getResultSize
public java.lang.Long getResultSize(org.apache.http.client.methods.CloseableHttpResponse response) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, org.json.simple.parser.ParseException, java.io.IOException
Description copied from interface:LanguageProcessor
Gets the result size of a given HTTP response- Specified by:
getResultSize
in interfaceLanguageProcessor
- Returns:
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
org.json.simple.parser.ParseException
java.io.IOException
-
-