public class Selectivity
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.openrdf.repository.RepositoryConnection |
con |
static int |
maxRunTime |
static java.io.BufferedWriter |
toBW |
static java.util.HashMap<java.lang.String,java.lang.Double> |
tpSelCache |
Constructor and Description |
---|
Selectivity() |
Modifier and Type | Method and Description |
---|---|
static long |
getEndpointTotalTriples(java.lang.String endpoint,
java.lang.String graph)
Get dataset/endpoint total number of triples
|
static double |
getMeanTriplePatternSelectivity(java.lang.String query,
java.lang.String endpoint,
java.lang.String graph,
java.lang.Long endpointSize)
get Mean Triple pattern selectivity
|
static java.lang.String |
getObject(org.openrdf.query.algebra.StatementPattern stmt)
Get object from triple pattern
|
static java.lang.String |
getObjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
Get label for the object vertex of a triple pattern
|
static java.lang.String |
getPredicate(org.openrdf.query.algebra.StatementPattern stmt)
Get Predicate from triple pattern
|
static java.lang.String |
getPredicateVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
Get label for the predicate vertex of a triple pattern
|
static long |
getQueryResultSize(java.lang.String queryStr,
java.lang.String endpoint,
java.lang.String sesameQueryType)
Get the result Size of the query
|
static java.lang.String |
getQueryString(org.openrdf.query.algebra.StatementPattern stmt,
java.lang.String tp,
java.lang.String graph)
Get query to the count of results against triple pattern
|
static java.lang.String |
getSubject(org.openrdf.query.algebra.StatementPattern stmt)
Get subject from triple pattern
|
static java.lang.String |
getSubjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
Get label for the subject vertex of a triple pattern
|
static java.lang.String |
getTriplePattern(org.openrdf.query.algebra.StatementPattern stmt)
Get triple pattern from statement pattern
|
static double |
getTriplePatternSelectivity(org.openrdf.query.algebra.StatementPattern stmt,
java.lang.String tp,
java.lang.String endpoint,
java.lang.String graph,
long endpointSize)
Get Triple pattern selectivity
|
static void |
initializeRepoConnection(java.lang.String endpointUrl)
Initialize repository for a SPARQL endpoint
|
static void |
main(java.lang.String[] args) |
public static org.openrdf.repository.RepositoryConnection con
public static java.util.HashMap<java.lang.String,java.lang.Double> tpSelCache
public static int maxRunTime
public static java.io.BufferedWriter toBW
public static void main(java.lang.String[] args) throws org.openrdf.repository.RepositoryException, org.openrdf.query.MalformedQueryException, org.openrdf.query.QueryEvaluationException, java.io.IOException
org.openrdf.repository.RepositoryException
org.openrdf.query.MalformedQueryException
org.openrdf.query.QueryEvaluationException
java.io.IOException
public static long getQueryResultSize(java.lang.String queryStr, java.lang.String endpoint, java.lang.String sesameQueryType) throws org.openrdf.repository.RepositoryException, org.openrdf.query.MalformedQueryException, java.io.IOException
queryStr
- SPARQL queryendpoint
- SPARQL endpointsesameQueryType
- Query Type (ask, select, describe, construct )org.openrdf.repository.RepositoryException
org.openrdf.query.MalformedQueryException
java.io.IOException
public static double getMeanTriplePatternSelectivity(java.lang.String query, java.lang.String endpoint, java.lang.String graph, java.lang.Long endpointSize) throws org.openrdf.query.MalformedQueryException, org.openrdf.repository.RepositoryException, org.openrdf.query.QueryEvaluationException
query
- SPARQL queryendpointSize
- Total number of triples patterns in the endpointendpoint
- Endpoint Urlgraph
- Default graph can be nullorg.openrdf.query.MalformedQueryException
org.openrdf.query.QueryEvaluationException
org.openrdf.repository.RepositoryException
public static long getEndpointTotalTriples(java.lang.String endpoint, java.lang.String graph) throws org.openrdf.repository.RepositoryException, org.openrdf.query.MalformedQueryException, org.openrdf.query.QueryEvaluationException
endpoint
- SPARQL endpointgraph
- Named Graph, can be nullorg.openrdf.repository.RepositoryException
org.openrdf.query.MalformedQueryException
org.openrdf.query.QueryEvaluationException
public static double getTriplePatternSelectivity(org.openrdf.query.algebra.StatementPattern stmt, java.lang.String tp, java.lang.String endpoint, java.lang.String graph, long endpointSize) throws org.openrdf.repository.RepositoryException, org.openrdf.query.MalformedQueryException, org.openrdf.query.QueryEvaluationException
stmt
- Statement patterntp
- triples representation of statement patternendpoint
- Endpoint Urlgraph
- Default graph can be nullendpointSize
- Total number of triples in the endpointorg.openrdf.repository.RepositoryException
org.openrdf.query.MalformedQueryException
org.openrdf.query.QueryEvaluationException
public static java.lang.String getTriplePattern(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- Statement patternpublic static java.lang.String getQueryString(org.openrdf.query.algebra.StatementPattern stmt, java.lang.String tp, java.lang.String graph)
stmt
- Triple patterntp
- Triple pattern as key for stmtFilters hash map. For checking whether stmt should contain Filter clause as wellgraph
- Default graph can be nullpublic static java.lang.String getPredicate(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- Triple patternpublic static java.lang.String getObject(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- Triple patternpublic static java.lang.String getSubject(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- Triple patternpublic static java.lang.String getObjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- triple patternpublic static java.lang.String getPredicateVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- triple patternpublic static java.lang.String getSubjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)
stmt
- triple patternpublic static void initializeRepoConnection(java.lang.String endpointUrl) throws org.openrdf.repository.RepositoryException
endpointUrl
- Endpoint Urlorg.openrdf.repository.RepositoryException