org.aksw.simba.largerdfbench.util

## Class QueryStatistics

- java.lang.Object
- - org.aksw.simba.largerdfbench.util.QueryStatistics

-     public class QueryStatistics
      extends java.lang.Object

  Generate various query statistics.
  Author:
    Saleem

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `boundObjLiteralCount`
    `static long` | `BoundObjLiteralCount`
    `static long` | `boundObjURICount`
    `static long` | `boundPredCount`
    `static long` | `boundSbjCount`
    `static long` | `grandTotalTriplePatterns`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryStatistics()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `getDirectQueryRelatedRDFizedStats(java.lang.String query)` Get the benchmark query features ( e.g resultsize, bgps mean join vertices etc)
    `static java.lang.String` | `getDirectQueryRelatedStats(java.lang.String query)` Get the benchmark query features ( e.g resultsize, bgps mean join vertices etc)
    `static java.util.HashSet<HyperGraph.Vertex>` | `getJoinVertexCount(java.util.HashSet<HyperGraph.Vertex> Vertices)` Get the the list of join vertices
    `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` | `getPredicateVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)` Get label for the predicate vertex of a triple pattern
    `static java.lang.String` | `getQueryStats(java.lang.String query, java.lang.String endpoint, java.lang.String graph, long datasetSize)` return query statistics as string
    `static java.lang.String` | `getRDFizedQueryStats(com.hp.hpl.jena.query.Query query, java.lang.String endpoint, java.lang.String graph, long datasetSize, java.lang.String baseURI)` return query statistics as string for RDFization
    `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` | `getUsedSPARQLClauses(java.lang.String queryStr)` Get the important set of SPARQL clauses used in the query
    `static HyperGraph.Vertex` | `getVertex(java.lang.String label, java.util.HashSet<HyperGraph.Vertex> V)` Retrieve a vertex having a specific label from a set of Vertrices
    `static void` | `main(java.lang.String[] args)`
    `static java.lang.String` | `rdfizeUsedSPARQLClauses(QueryStats queryStats, com.hp.hpl.jena.query.Query query)`
    `static boolean` | `vertexExist(HyperGraph.Vertex sbjVertex, java.util.HashSet<HyperGraph.Vertex> V)` Check if a vertex already exists in set of all vertices

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### boundObjLiteralCount

          public static final int boundObjLiteralCount

      See Also:
        Constant Field Values

    - #### boundSbjCount

          public static long boundSbjCount

    - #### boundPredCount

          public static long boundPredCount

    - #### boundObjURICount

          public static long boundObjURICount

    - #### BoundObjLiteralCount

          public static long BoundObjLiteralCount

    - #### grandTotalTriplePatterns

          public static long grandTotalTriplePatterns

  - ### Constructor Detail

    - #### QueryStatistics

          public QueryStatistics()

  - ### Method Detail

    - #### main

          public static void main(java.lang.String[] args)
                           throws org.openrdf.repository.RepositoryException,
                                  org.openrdf.query.MalformedQueryException,
                                  org.openrdf.query.QueryEvaluationException,
                                  java.io.IOException

      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`
        `java.io.IOException`

    - #### getQueryStats

          public static java.lang.String getQueryStats(java.lang.String query,
                                                       java.lang.String endpoint,
                                                       java.lang.String graph,
                                                       long datasetSize)
                                                throws org.openrdf.query.MalformedQueryException,
                                                       org.openrdf.repository.RepositoryException,
                                                       org.openrdf.query.QueryEvaluationException

      return query statistics as string
      Parameters:
        `query` - SPARQL query
        `endpoint` - endpoint url
        `graph` - Default Graph can be null
        `datasetSize` - Dataset size
      Throws:
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`
        `org.openrdf.repository.RepositoryException`

    - #### getRDFizedQueryStats

          public static java.lang.String getRDFizedQueryStats(com.hp.hpl.jena.query.Query query,
                                                              java.lang.String endpoint,
                                                              java.lang.String graph,
                                                              long datasetSize,
                                                              java.lang.String baseURI)
                                                       throws org.openrdf.query.MalformedQueryException,
                                                              org.openrdf.repository.RepositoryException,
                                                              org.openrdf.query.QueryEvaluationException

      return query statistics as string for RDFization
      Parameters:
        `query` - SPARQL query
        `endpoint` - endpoint url
        `graph` - Default Graph can be null
        `datasetSize` - Dataset size
        `baseURI` -
      Throws:
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`
        `org.openrdf.repository.RepositoryException`

    - #### rdfizeUsedSPARQLClauses

          public static java.lang.String rdfizeUsedSPARQLClauses(QueryStats queryStats,
                                                                 com.hp.hpl.jena.query.Query query)

    - #### getUsedSPARQLClauses

          public static java.lang.String getUsedSPARQLClauses(java.lang.String queryStr)
                                                       throws org.openrdf.query.MalformedQueryException

      Get the important set of SPARQL clauses used in the query
      Parameters:
        `queryStr` - SPARQL query
      Returns:
        stats SPARQL clauses as string line by line
      Throws:
        `org.openrdf.query.MalformedQueryException`

    - #### getDirectQueryRelatedRDFizedStats

          public static java.lang.String getDirectQueryRelatedRDFizedStats(java.lang.String query)
                                                                    throws org.openrdf.query.MalformedQueryException

      Get the benchmark query features ( e.g resultsize, bgps mean join vertices etc)
      Parameters:
        `query` - SPARQL query
      Returns:
        stats Query Features as string
      Throws:
        `org.openrdf.query.MalformedQueryException`

    - #### getDirectQueryRelatedStats

          public static java.lang.String getDirectQueryRelatedStats(java.lang.String query)
                                                             throws org.openrdf.query.MalformedQueryException

      Get the benchmark query features ( e.g resultsize, bgps mean join vertices etc)
      Parameters:
        `query` - SPARQL query
      Returns:
        stats Query Features as string
      Throws:
        `org.openrdf.query.MalformedQueryException`

    - #### getJoinVertexCount

          public static java.util.HashSet<HyperGraph.Vertex> getJoinVertexCount(java.util.HashSet<HyperGraph.Vertex> Vertices)

      Get the the list of join vertices
      Parameters:
        `Vertices` - List of vertices in BGP
      Returns:
        V Collection of join vertices

    - #### getObjectVertexLabel

          public static java.lang.String getObjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)

      Get label for the object vertex of a triple pattern
      Parameters:
        `stmt` - triple pattern
      Returns:
        label Vertex label

    - #### getPredicateVertexLabel

          public static java.lang.String getPredicateVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)

      Get label for the predicate vertex of a triple pattern
      Parameters:
        `stmt` - triple pattern
      Returns:
        label Vertex label

    - #### getSubjectVertexLabel

          public static java.lang.String getSubjectVertexLabel(org.openrdf.query.algebra.StatementPattern stmt)

      Get label for the subject vertex of a triple pattern
      Parameters:
        `stmt` - triple pattern
      Returns:
        label Vertex label

    - #### vertexExist

          public static boolean vertexExist(HyperGraph.Vertex sbjVertex,
                                            java.util.HashSet<HyperGraph.Vertex> V)

      Check if a vertex already exists in set of all vertices
      Parameters:
        `sbjVertex` -
        `V` - Set of all vertices
      Returns:

    - #### getVertex

          public static HyperGraph.Vertex getVertex(java.lang.String label,
                                                    java.util.HashSet<HyperGraph.Vertex> V)

      Retrieve a vertex having a specific label from a set of Vertrices
      Parameters:
        `label` - Label of vertex to be retrieved
        `V` - Set of vertices
      Returns:
        Vertex if exist otherwise null