Class BGPImpl

java.lang.Object
se.liu.ida.hefquin.base.query.impl.BGPImpl
All Implemented Interfaces:
BGP, Query, SPARQLGraphPattern
Direct Known Subclasses:
StarPattern

public class BGPImpl extends Object implements BGP
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    BGPImpl(List<org.apache.jena.graph.Triple> tps)
     
     
    BGPImpl(org.apache.jena.sparql.core.BasicPattern pattern)
     
    BGPImpl(org.apache.jena.sparql.core.PathBlock pattern)
    Assumes that the given PathBlock does not contain property path patterns (but only triple patterns).
    BGPImpl(org.apache.jena.sparql.syntax.ElementPathBlock pattern)
    Assumes that the given ElementPathBlock does not contain property path patterns (but only triple patterns).
    BGPImpl(BGP otherBGP, BGP... otherBGPs)
     
    BGPImpl(BGP otherBGP, TriplePattern tp)
     
    BGPImpl(TriplePattern tp, BGP otherBGP)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    Applies the given solution mapping to this graph pattern and returns the resulting graph pattern in which all occurrences of the variables bound by the given solution mapping are replaced by the RDF terms that the solution mappings assigns to these variables.
    boolean
     
    Returns a set of all triple patterns that are contained within this graph pattern.
    Set<org.apache.jena.sparql.core.Var>
    Returns the set of all variables mentioned in this graph pattern, except for the variables that occur only in expressions (in FILTER or in BIND).
    Set<org.apache.jena.sparql.core.Var>
    Returns the variables that are guaranteed to be bound in every solution mapping produced for this graph pattern.
    int
    Returns the number of times any RDF term is mentioned in this graph pattern (if the same term is mentioned multiple times, then each of these mentions is counted), but ignores terms mentions in expressions (in FILTER or in BIND).
    int
    Returns the number of times any variable is mentioned in this graph pattern (if the same variable is mentioned multiple times, then each of these mentions is counted), but ignores variable mentions in expressions (in FILTER or in BIND).
    Set<org.apache.jena.sparql.core.Var>
    Returns the variables that may be bound in solution mappings produced for this graph pattern, but that are not guaranteed to be bound in every such solution mapping.
    Returns an unmodifiable set of triple patterns.
    int
     
    merge(BGP bgp, org.apache.jena.sparql.syntax.Element elmt)
    Merges the given BGP into the given graph pattern.
    mergeWith(BGP otherBGP)
    Return a BGP that contains all triple patterns of this BGP plus all triple patterns of the given BGP.
    Merges this graph pattern with the given graph pattern, using join semantics, and returns the resulting, merged pattern.
    Returns a BGP that contains all triple patterns of this BGP plus the given triple pattern.
    Returns a string representation of the BGP

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface se.liu.ida.hefquin.base.query.SPARQLGraphPattern

    getExpectedVariables, mergeWith, mergeWith
  • Constructor Details

    • BGPImpl

      public BGPImpl()
    • BGPImpl

      public BGPImpl(Set<TriplePattern> tps)
    • BGPImpl

      public BGPImpl(TriplePattern tp, TriplePattern... tps)
    • BGPImpl

      public BGPImpl(BGP otherBGP, BGP... otherBGPs)
    • BGPImpl

      public BGPImpl(TriplePattern tp, BGP otherBGP)
    • BGPImpl

      public BGPImpl(BGP otherBGP, TriplePattern tp)
    • BGPImpl

      public BGPImpl(List<org.apache.jena.graph.Triple> tps)
    • BGPImpl

      public BGPImpl(org.apache.jena.sparql.core.BasicPattern pattern)
    • BGPImpl

      public BGPImpl(org.apache.jena.sparql.syntax.ElementPathBlock pattern)
      Assumes that the given ElementPathBlock does not contain property path patterns (but only triple patterns). If it does, this methods throws an IllegalArgumentException.
    • BGPImpl

      public BGPImpl(org.apache.jena.sparql.core.PathBlock pattern)
      Assumes that the given PathBlock does not contain property path patterns (but only triple patterns). If it does, this methods throws an IllegalArgumentException.
  • Method Details

    • getTriplePatterns

      public Set<TriplePattern> getTriplePatterns()
      Description copied from interface: BGP
      Returns an unmodifiable set of triple patterns.
      Specified by:
      getTriplePatterns in interface BGP
    • addTriplePattern

      public void addTriplePattern(TriplePattern tp)
    • toString

      public String toString()
      Description copied from interface: BGP
      Returns a string representation of the BGP
      Specified by:
      toString in interface BGP
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getAllMentionedTPs

      public Set<TriplePattern> getAllMentionedTPs()
      Description copied from interface: SPARQLGraphPattern
      Returns a set of all triple patterns that are contained within this graph pattern.
      Specified by:
      getAllMentionedTPs in interface SPARQLGraphPattern
    • getCertainVariables

      public Set<org.apache.jena.sparql.core.Var> getCertainVariables()
      Description copied from interface: SPARQLGraphPattern
      Returns the variables that are guaranteed to be bound in every solution mapping produced for this graph pattern.
      Specified by:
      getCertainVariables in interface SPARQLGraphPattern
    • getPossibleVariables

      public Set<org.apache.jena.sparql.core.Var> getPossibleVariables()
      Description copied from interface: SPARQLGraphPattern
      Returns the variables that may be bound in solution mappings produced for this graph pattern, but that are not guaranteed to be bound in every such solution mapping.
      Specified by:
      getPossibleVariables in interface SPARQLGraphPattern
    • getAllMentionedVariables

      public Set<org.apache.jena.sparql.core.Var> getAllMentionedVariables()
      Description copied from interface: SPARQLGraphPattern
      Returns the set of all variables mentioned in this graph pattern, except for the variables that occur only in expressions (in FILTER or in BIND).
      Specified by:
      getAllMentionedVariables in interface SPARQLGraphPattern
    • getNumberOfVarMentions

      public int getNumberOfVarMentions()
      Description copied from interface: SPARQLGraphPattern
      Returns the number of times any variable is mentioned in this graph pattern (if the same variable is mentioned multiple times, then each of these mentions is counted), but ignores variable mentions in expressions (in FILTER or in BIND).
      Specified by:
      getNumberOfVarMentions in interface SPARQLGraphPattern
    • getNumberOfTermMentions

      public int getNumberOfTermMentions()
      Description copied from interface: SPARQLGraphPattern
      Returns the number of times any RDF term is mentioned in this graph pattern (if the same term is mentioned multiple times, then each of these mentions is counted), but ignores terms mentions in expressions (in FILTER or in BIND).
      Specified by:
      getNumberOfTermMentions in interface SPARQLGraphPattern
    • applySolMapToGraphPattern

      public BGP applySolMapToGraphPattern(SolutionMapping sm) throws VariableByBlankNodeSubstitutionException
      Description copied from interface: SPARQLGraphPattern
      Applies the given solution mapping to this graph pattern and returns the resulting graph pattern in which all occurrences of the variables bound by the given solution mapping are replaced by the RDF terms that the solution mappings assigns to these variables.
      Specified by:
      applySolMapToGraphPattern in interface BGP
      Specified by:
      applySolMapToGraphPattern in interface SPARQLGraphPattern
      Throws:
      VariableByBlankNodeSubstitutionException - if one of the variables would be replaced by a blank node
    • mergeWith

      public SPARQLGraphPattern mergeWith(SPARQLGraphPattern other)
      Description copied from interface: SPARQLGraphPattern
      Merges this graph pattern with the given graph pattern, using join semantics, and returns the resulting, merged pattern.
      Specified by:
      mergeWith in interface SPARQLGraphPattern
    • mergeWith

      public BGP mergeWith(TriplePattern tp)
      Description copied from interface: BGP
      Returns a BGP that contains all triple patterns of this BGP plus the given triple pattern. This method is a more specific version of SPARQLGraphPattern.mergeWith(SPARQLGraphPattern).
      Specified by:
      mergeWith in interface BGP
    • mergeWith

      public BGP mergeWith(BGP otherBGP)
      Description copied from interface: BGP
      Return a BGP that contains all triple patterns of this BGP plus all triple patterns of the given BGP. This method is a more specific version of SPARQLGraphPattern.mergeWith(SPARQLGraphPattern).
      Specified by:
      mergeWith in interface BGP
    • merge

      public static SPARQLGraphPattern merge(BGP bgp, org.apache.jena.sparql.syntax.Element elmt)
      Merges the given BGP into the given graph pattern. If the given graph pattern is also a BGP, then the resulting graph pattern is a BGP that is the union of the two given BGPs. Otherwise, the resulting graph pattern is the given graph pattern with the BGP joined into it.