Package dev.roanh.gmark.lang.cpq
Class IntersectionCPQ
java.lang.Object
dev.roanh.gmark.lang.cpq.IntersectionCPQ
- All Implemented Interfaces:
QueryFragment
,CPQ
,QueryLanguageSyntax
,OutputFormal
,OutputSQL
,OutputXML
CPQ modelling the intersection between CPQs
(also known as the conjunction operation).
-
Field Summary
Fields inherited from interface dev.roanh.gmark.lang.QueryLanguageSyntax
CHAR_DISJUNCTION, CHAR_INTERSECTION, CHAR_INVERSE, CHAR_JOIN, CHAR_KLEENE
-
Constructor Summary
ConstructorDescriptionIntersectionCPQ
(List<CPQ> cpq) Constructs a new intersection CPQ with the given CPQs to intersect. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the diameter of this CPQ.The top level operation represented by this query fragment.boolean
isLoop()
Tests if this CPQ is a loop, meaning its source and target are the same.Converts this query fragment to an equivalent abstract syntax tree.Converts this object to its formal logic form.toQueryGraph
(QueryGraphCPQ.Vertex source, QueryGraphCPQ.Vertex target) Computes and returns the query graph for this CPQ using the given source and target vertices for the computation.toString()
void
writeSQL
(IndentWriter writer) Writes the SQL representation of this object to the given writer.void
writeXML
(IndentWriter writer) Writes this object as XML to the given writer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.roanh.gmark.lang.cpq.CPQ
computeCore, getQueryLanguage, isHomomorphicTo, toQueryGraph
-
Field Details
-
cpq
The CPQs of the intersection.
-
-
Constructor Details
-
IntersectionCPQ
Constructs a new intersection CPQ with the given CPQs to intersect.- Parameters:
cpq
- The CPQs to intersect.- Throws:
IllegalArgumentException
- When less than two CPQs are provided.
-
-
Method Details
-
writeSQL
Description copied from interface:OutputSQL
Writes the SQL representation of this object to the given writer. -
toFormalSyntax
Description copied from interface:OutputFormal
Converts this object to its formal logic form.- Specified by:
toFormalSyntax
in interfaceOutputFormal
- Returns:
- The formal representation of this object.
-
toString
-
writeXML
Description copied from interface:OutputXML
Writes this object as XML to the given writer. -
toQueryGraph
Description copied from interface:CPQ
Computes and returns the query graph for this CPQ using the given source and target vertices for the computation. Usually usingCPQ.toQueryGraph()
instead should be sufficient for most use cases, using this version instead can lead to unexpected results.- Specified by:
toQueryGraph
in interfaceCPQ
- Parameters:
source
- The source vertex to use.target
- The target vertex to use.- Returns:
- The query graph for this CPQ.
- See Also:
-
getDiameter
public int getDiameter()Description copied from interface:CPQ
Returns the diameter of this CPQ. The diameter of a CPQ is the largest number of labels to which the join operation is applied. A simpler way to think of this concept is the length of the largest path through the CPQ from source to target.- Specified by:
getDiameter
in interfaceCPQ
- Returns:
- The diameter of this CPQ.
-
isLoop
public boolean isLoop()Description copied from interface:CPQ
Tests if this CPQ is a loop, meaning its source and target are the same. When visualised as a query graph this means that the source and target node are the same node. In its grammar form this means that there is an intersection with identity at the highest level in the CPQ. -
getOperationType
Description copied from interface:QueryFragment
The top level operation represented by this query fragment.- Specified by:
getOperationType
in interfaceQueryFragment
- Returns:
- The top level operation for this query fragment.
-
toAbstractSyntaxTree
Description copied from interface:QueryFragment
Converts this query fragment to an equivalent abstract syntax tree.- Specified by:
toAbstractSyntaxTree
in interfaceQueryFragment
- Returns:
- The constructed Abstract Syntax Tree (AST).
-