Class ResourceShape

java.lang.Object
org.aksw.jena_sparql_api.shape.ResourceShape

public class ResourceShape extends Object
A graph expression is a SPARQL expression which only makes use of the variables ?s ?p and ?o The evaluation of a graph expression te over an RDF dataset D yields a graph (a set of triples) [[te]]_D Maybe we should take a set of triples, derive a set of related resources, and then for this related set of resources specify which triples we are interested in again. In this case, the model is Map<Expr, TripleTree> i.e. the expression evaluates to a resource for each triple, and these resources are used for further lookups. However, how would we navigate in inverse direction? Each resource r is associated with a set of ingoing and outgoing triples: outgoing: { t | t in G and t.s = r} ingoing: { t | t in G and t.o = r} Navigating to the set of related triples: Let G be the set of all triples and G1 and G2 subsetof G be two graphs. { t2 | t1 in G1 and expr(t1, t2)} We could use expressions over the additional variables ?x ?y ?z to perform joins: (?s ?p ?o ?x ?y ?z) ?s = ?x G1 x G2
Author:
raven
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.aksw.jenax.sparql.fragment.api.Fragment2
    asRelation(org.apache.jena.sparql.expr.Expr expr)
     
    static void
    collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, ResourceShape source, boolean includeGraph)
     
    static void
    collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, ResourceShape source, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
     
    static void
    collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape> map, boolean isInverse, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
     
    static void
    collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, ResourceShape source, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
     
    static List<org.aksw.jenax.sparql.fragment.api.Fragment1>
    collectConcepts(ResourceShape source, boolean includeGraph)
     
    static boolean
    contains(Collection<org.apache.jena.sparql.expr.Expr> exprs, org.apache.jena.graph.Triple triple, org.apache.jena.sparql.function.FunctionEnv functionEnv)
    Whether a triple matches any of the ingoing or outgoing filter expression of this node
    static org.aksw.jenax.sparql.fragment.api.Fragment1
    createConcept(org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, org.aksw.jenax.sparql.fragment.api.Fragment2 predicateRelation, boolean isInverse, boolean includeGraph)
    Creates elements for this node and then descends into its children
    static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.graph.Graph>
    createMappedConcept(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
     
    static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.graph.Graph>
    createMappedConcept(org.apache.jena.query.Query query)
     
    static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.sparql.core.DatasetGraph>
    createMappedConcept2(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
     
    static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.sparql.core.DatasetGraph>
    createMappedConcept2(org.apache.jena.query.Query query)
     
    static org.apache.jena.query.Query
    createQuery(List<org.aksw.jenax.sparql.fragment.api.Fragment1> concepts, org.aksw.jenax.sparql.fragment.api.Fragment1 filter)
     
    static org.apache.jena.query.Query
    createQuery(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
     
    static org.apache.jena.query.Query
    createQueryConstruct(List<org.aksw.jenax.sparql.fragment.api.Fragment1> concepts, org.aksw.jenax.sparql.fragment.impl.Concept filter)
    Deprecated.
    boolean
     
    void
     
    static org.apache.jena.graph.Graph
    fetchData(QueryExecutionFactoryQuery qef, ResourceShape shape, org.apache.jena.graph.Node node)
     
    Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape>
     
    Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape>
     
    static List<org.aksw.jenax.sparql.fragment.api.Fragment2>
    group(Collection<org.aksw.jenax.sparql.fragment.api.Fragment2> relations)
     
    int
    Get all triples about the titles of books, together with the books' male buyers' names and age.
    boolean
     
    static org.apache.jena.sparql.syntax.Element
    remapVars(org.apache.jena.sparql.syntax.Element element, Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.core.Var> varMap)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ResourceShape

      public ResourceShape()
  • Method Details

    • isEmpty

      public boolean isEmpty()
    • getOutgoing

      public Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape> getOutgoing()
    • getIngoing

      public Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape> getIngoing()
    • extend

      public void extend(ResourceShape that)
    • collectConcepts

      public static List<org.aksw.jenax.sparql.fragment.api.Fragment1> collectConcepts(ResourceShape source, boolean includeGraph)
    • collectConcepts

      public static void collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, ResourceShape source, boolean includeGraph)
    • collectConcepts

      public static void collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, ResourceShape source, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
    • collectConcepts

      public static void collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, ResourceShape source, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
    • collectConcepts

      public static void collectConcepts(Collection<org.aksw.jenax.sparql.fragment.api.Fragment1> result, org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, Map<org.aksw.jenax.sparql.fragment.api.Fragment2,ResourceShape> map, boolean isInverse, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, boolean includeGraph)
    • group

      public static List<org.aksw.jenax.sparql.fragment.api.Fragment2> group(Collection<org.aksw.jenax.sparql.fragment.api.Fragment2> relations)
    • asRelation

      public static org.aksw.jenax.sparql.fragment.api.Fragment2 asRelation(org.apache.jena.sparql.expr.Expr expr)
    • remapVars

      public static org.apache.jena.sparql.syntax.Element remapVars(org.apache.jena.sparql.syntax.Element element, Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.core.Var> varMap)
    • createQuery

      public static org.apache.jena.query.Query createQuery(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
    • createQueryConstruct

      @Deprecated public static org.apache.jena.query.Query createQueryConstruct(List<org.aksw.jenax.sparql.fragment.api.Fragment1> concepts, org.aksw.jenax.sparql.fragment.impl.Concept filter)
      Deprecated.
      Deprecated, because with the construct approach we cannot get a tripe's context resource
      Parameters:
      concepts -
      filter -
      Returns:
    • createMappedConcept2

      public static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.sparql.core.DatasetGraph> createMappedConcept2(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
    • createMappedConcept

      public static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.graph.Graph> createMappedConcept(ResourceShape resourceShape, org.aksw.jenax.sparql.fragment.api.Fragment1 filter, boolean includeGraph)
    • createMappedConcept2

      public static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.sparql.core.DatasetGraph> createMappedConcept2(org.apache.jena.query.Query query)
    • createMappedConcept

      public static org.aksw.jenax.analytics.core.MappedConcept<org.apache.jena.graph.Graph> createMappedConcept(org.apache.jena.query.Query query)
    • createQuery

      public static org.apache.jena.query.Query createQuery(List<org.aksw.jenax.sparql.fragment.api.Fragment1> concepts, org.aksw.jenax.sparql.fragment.api.Fragment1 filter)
    • createConcept

      public static org.aksw.jenax.sparql.fragment.api.Fragment1 createConcept(org.aksw.jenax.sparql.fragment.api.Fragment1 baseConcept, org.aksw.commons.collections.generator.Generator<org.apache.jena.sparql.core.Var> vargen, org.aksw.jenax.sparql.fragment.api.Fragment2 predicateRelation, boolean isInverse, boolean includeGraph)
      Creates elements for this node and then descends into its children
      Parameters:
      predicateConcept -
      target -
      isInverse -
      Returns:
    • contains

      public static boolean contains(Collection<org.apache.jena.sparql.expr.Expr> exprs, org.apache.jena.graph.Triple triple, org.apache.jena.sparql.function.FunctionEnv functionEnv)
      Whether a triple matches any of the ingoing or outgoing filter expression of this node
      Parameters:
      triple -
      functionEnv -
      Returns:
    • hashCode

      public int hashCode()
      Get all triples about the titles of books, together with the books' male buyers' names and age. The generated query has the structure Construct { ?s ?p ?o } { { ?x a Book . Bind(?x as ?s)} # Root concept { # get the 'buyer' triples ?s ?p ?o . Filter(?p = boughtBy) // outgoing { ?o gender male }} // restricting the resources of the relation #Optional { # ?x ?y ?z . Filter(?y = rdfs:label) #} } Union { { # get the buyers names - requires repetition of above's pattern ?x ?y ?s . Filter(?y = boughtBy) { ?s gender male }} // restricting the resources of the relation ?s ?p ?o . Filter(?p = rdfs:label) } Union { ?s ?p ?o . Filter(?p = dc:title && langMatches(lang(?o), 'en')) # outgoing } }
      Overrides:
      hashCode in class Object
      Parameters:
      root -
      Returns:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fetchData

      public static org.apache.jena.graph.Graph fetchData(QueryExecutionFactoryQuery qef, ResourceShape shape, org.apache.jena.graph.Node node)