org.aksw.simba.largerdfbench.util

## Class StructurednessCalculator

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

-     public class StructurednessCalculator
      extends java.lang.Object

  This class is not used in FEASIBLE Benchmark Calculate the structuredness or coherence of a dataset as defined in Duan et al. paper titled "Apples and Oranges: A Comparison of RDF Benchmarks and Real RDF Datasets". The structuredness is measured in interval [0,1] with values close to 0 corresponding to low structuredness, and 1 corresponding to perfect structuredness. The paper concluded that synthetic datasets have high structurenes as compared to real datasets.
  Author:
    Saleem

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.openrdf.repository.RepositoryConnection` | `con`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StructurednessCalculator()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `getOccurences(java.lang.String predicate, java.lang.String type, java.lang.String namedGraph)` Get occurences of a predicate within a type
    `static java.util.Set<java.lang.String>` | `getRDFTypes(java.lang.String namedGraph)` Get distinct set of rdf:type
    `static double` | `getStructurednessValue(java.lang.String endpointUrl, java.lang.String namedGraph)` Get the structuredness/coherence value [0,1] of a dataset
    `static long` | `getTypeInstancesSize(java.lang.String type, java.lang.String namedGraph)` Get the number of distinct instances of a specfici type
    `static java.util.Set<java.lang.String>` | `getTypePredicates(java.lang.String type, java.lang.String namedGraph)` Get all distinct predicates of a specific type
    `static double` | `getTypesWeightedDenomSum(java.util.Set<java.lang.String> types, java.lang.String namedGraph)` Get the denominator of weighted sum all types.
    `static void` | `initializeRepoConnection(java.lang.String endpointUrl)` Initialize repository for a SPARQL endpoint
    `static void` | `main(java.lang.String[] args)`

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

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

- - ### Field Detail

    - #### con

          public static org.openrdf.repository.RepositoryConnection con

  - ### Constructor Detail

    - #### StructurednessCalculator

          public StructurednessCalculator()

  - ### Method Detail

    - #### main

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

      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`

    - #### getStructurednessValue

          public static double getStructurednessValue(java.lang.String endpointUrl,
                                                      java.lang.String namedGraph)
                                               throws org.openrdf.repository.RepositoryException,
                                                      org.openrdf.query.MalformedQueryException,
                                                      org.openrdf.query.QueryEvaluationException

      Get the structuredness/coherence value [0,1] of a dataset
      Parameters:
        `endpointUrl` - SPARQL endpoint URL
        `namedGraph` - Named Graph of dataset. Can be null, in that case all named graphs will be considered
      Returns:
        structuredness Structuredness or coherence value
      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`

    - #### getTypesWeightedDenomSum

          public static double getTypesWeightedDenomSum(java.util.Set<java.lang.String> types,
                                                        java.lang.String namedGraph)
                                                 throws org.openrdf.repository.RepositoryException,
                                                        org.openrdf.query.MalformedQueryException,
                                                        org.openrdf.query.QueryEvaluationException

      Get the denominator of weighted sum all types. Please see Duan et. all paper apple oranges
      Parameters:
        `types` - Set of rdf:types
        `namedGraph` - Named graph
      Returns:
        sum Sum of weighted denominator
      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`

    - #### getOccurences

          public static long getOccurences(java.lang.String predicate,
                                           java.lang.String type,
                                           java.lang.String namedGraph)
                                    throws java.lang.NumberFormatException,
                                           org.openrdf.query.QueryEvaluationException,
                                           org.openrdf.repository.RepositoryException,
                                           org.openrdf.query.MalformedQueryException

      Get occurences of a predicate within a type
      Parameters:
        `predicate` - Predicate
        `type` - Type
        `namedGraph` - Named Graph
      Returns:
        predicateOccurences Predicate occurence value
      Throws:
        `java.lang.NumberFormatException`
        `org.openrdf.query.QueryEvaluationException`
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`

    - #### getTypeInstancesSize

          public static long getTypeInstancesSize(java.lang.String type,
                                                  java.lang.String namedGraph)
                                           throws org.openrdf.repository.RepositoryException,
                                                  org.openrdf.query.MalformedQueryException,
                                                  org.openrdf.query.QueryEvaluationException

      Get the number of distinct instances of a specfici type
      Parameters:
        `type` - Type or class name
        `namedGraph` - Named graph
      Returns:
        typeInstancesSize No of instances of type
      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`

    - #### getTypePredicates

          public static java.util.Set<java.lang.String> getTypePredicates(java.lang.String type,
                                                                          java.lang.String namedGraph)
                                                                   throws org.openrdf.repository.RepositoryException,
                                                                          org.openrdf.query.MalformedQueryException,
                                                                          org.openrdf.query.QueryEvaluationException

      Get all distinct predicates of a specific type
      Parameters:
        `type` - Type of class
        `namedGraph` - Named Graph can be null
      Returns:
        typePredicates Set of predicates of type
      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`

    - #### initializeRepoConnection

          public static void initializeRepoConnection(java.lang.String endpointUrl)
                                               throws org.openrdf.repository.RepositoryException

      Initialize repository for a SPARQL endpoint
      Parameters:
        `endpointUrl` - Endpoint Url
      Throws:
        `org.openrdf.repository.RepositoryException`

    - #### getRDFTypes

          public static java.util.Set<java.lang.String> getRDFTypes(java.lang.String namedGraph)
                                                             throws org.openrdf.repository.RepositoryException,
                                                                    org.openrdf.query.MalformedQueryException,
                                                                    org.openrdf.query.QueryEvaluationException

      Get distinct set of rdf:type
      Parameters:
        `namedGraph` - Named Graph of dataset can be null in that case all namedgraphs will be considered
      Returns:
        types Set of rdf:types
      Throws:
        `org.openrdf.repository.RepositoryException`
        `org.openrdf.query.MalformedQueryException`
        `org.openrdf.query.QueryEvaluationException`