cgp.runtime
Class GraphType

java.lang.Object
  |
  +--cgp.runtime.Type
        |
        +--cgp.runtime.GraphType

public class GraphType
extends Type


Field Summary
static notio.CopyingScheme COPYING_SCHEME
           
static notio.CopyingScheme COPYING_SCHEME_NO_COMMENTS
           
private  KBase kbase
           
static notio.MatchingScheme MATCH_EXACT
           
static notio.MatchingScheme MATCH_SUBGRAPH
           
private  notio.Graph value
           
 
Fields inherited from class cgp.runtime.Type
kbStack, scopeStack, type
 
Constructor Summary
GraphType(java.io.File f)
           
GraphType(notio.Graph g)
           
GraphType(notio.Relation r)
           
GraphType(java.lang.String s)
           
 
Method Summary
 Type add(GraphType extraGraph)
          Add to a copy of this graph and return it.
private  boolean areConceptsCompatible(notio.Concept[] c1, notio.Concept[] c2)
          Are the specified concepts type compatible? Note that this does not mean that they are necessarily restriction compatible.
 boolean areDesignatorsEquivalent(notio.Graph other)
          Check designator and marker equivalence together by iterating over each concept's designator (which consists of a literal, marker, or name) and testing pCG value equivalence.
private  boolean areRelationsCompatible(notio.Relation r1, notio.Relation r2)
          Is the first conceptual relation supertype compatible with the second? For this to be true, the first's relation must be the same type or a supertype of the second, and the same must hold for each concept argument of the two conceptual relations.
 boolean containsActorNodes()
          Does this graph contain one or more actor relations? This asks nothing about the validity of any such actors, a task carried out at pCG actor definition time.
 GraphType copy()
          Make a copy of this graph.
 Type eqOp(Type other)
           
 boolean equals(java.lang.Object other)
           
 ListType getActors()
          Returns a list of lists each of which is headed by a actor name, followed by a list of input concepts, and a list of output concepts.
 ListType getConcepts()
          Returns a list of all concepts in this graph.
 KBase getKBase()
           
 ListType getRelations()
          Returns a list of lists each of which is headed by a relation name, followed by a list of input concepts, and a list of output concepts.
 notio.Graph getValue()
           
 notio.Graph join(notio.Graph g)
          Attempt to join the specified graph onto this one.
 Type join(GraphType g)
          Join operation.
 notio.Graph joinAtHead(notio.Graph g)
          Attempt to join the specified graph onto this one at their heads.
 Type joinAtHead(GraphType g)
          Join at head concepts operation.
 GraphType nocomments()
          Make a copy of this graph without comments.
 notio.Graph parseGraph(java.lang.Object o)
           
 notio.Graph project(notio.Graph filter)
          Project the specified graph onto this graph, returning the projection as a new graph, or null.
 Type project(GraphType filterGraph)
          Project the specified graph onto this graph, returning the projection as a new graph, or undefined.
 java.lang.String toString()
           
 
Methods inherited from class cgp.runtime.Type
addOp, andOp, divideOp, geOp, getAttr, getKBStack, getNthOp, getScopeStack, getType, gtOp, invokeMemberFunc, isOp, leOp, ltOp, modulusOp, multiplyOp, negateOp, neOp, notOp, operationError, orOp, setAttr, setKBStack, setNthOp, setScopeStack, setType, subtractOp
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

COPYING_SCHEME

public static notio.CopyingScheme COPYING_SCHEME

COPYING_SCHEME_NO_COMMENTS

public static notio.CopyingScheme COPYING_SCHEME_NO_COMMENTS

MATCH_EXACT

public static notio.MatchingScheme MATCH_EXACT

MATCH_SUBGRAPH

public static notio.MatchingScheme MATCH_SUBGRAPH

value

private notio.Graph value

kbase

private KBase kbase
Constructor Detail

GraphType

public GraphType(notio.Graph g)

GraphType

public GraphType(java.lang.String s)

GraphType

public GraphType(java.io.File f)

GraphType

public GraphType(notio.Relation r)
Method Detail

getValue

public notio.Graph getValue()

getKBase

public KBase getKBase()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

areDesignatorsEquivalent

public boolean areDesignatorsEquivalent(notio.Graph other)
Check designator and marker equivalence together by iterating over each concept's designator (which consists of a literal, marker, or name) and testing pCG value equivalence. If there is no designator, the value will be "undefined".

eqOp

public Type eqOp(Type other)
Overrides:
eqOp in class Type

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

containsActorNodes

public boolean containsActorNodes()
Does this graph contain one or more actor relations? This asks nothing about the validity of any such actors, a task carried out at pCG actor definition time.

parseGraph

public notio.Graph parseGraph(java.lang.Object o)

areConceptsCompatible

private boolean areConceptsCompatible(notio.Concept[] c1,
                                      notio.Concept[] c2)
Are the specified concepts type compatible? Note that this does not mean that they are necessarily restriction compatible. Concepts in the first array must be the same type or supertypes of those in the second. The number of concepts in each array must be the same.

areRelationsCompatible

private boolean areRelationsCompatible(notio.Relation r1,
                                       notio.Relation r2)
Is the first conceptual relation supertype compatible with the second? For this to be true, the first's relation must be the same type or a supertype of the second, and the same must hold for each concept argument of the two conceptual relations. The number of arguments must also be the same as must the arc directionality of the arguments. The test here is for signature compatibility only, not restrictability.

project

public notio.Graph project(notio.Graph filter)
Project the specified graph onto this graph, returning the projection as a new graph, or null. The parameter can be seen as a filter which will be applied to this graph. The projection will only be successful if the filter graph is a supertype of this graph, i.e. all relations and concepts in this graph are subtypes or the same as those in the filter graph, and the filter's concepts are restrictable by type and/or referent to the target's. Note that the filter graph may have more or less nodes than the target.

join

public notio.Graph join(notio.Graph g)
Attempt to join the specified graph onto this one. Currently, the operation consists of a search for a concept in the two graphs which is identical, and there is no type restriction performed. Once identified, the graphs are joined on the two concepts. TBD: Probably could rely upon matching scheme to find compatible concepts.

joinAtHead

public notio.Graph joinAtHead(notio.Graph g)
Attempt to join the specified graph onto this one at their heads. This assumes that the concepts at the heads are identical. If not, the join will fail. The head concept of a graph is taken to be the zeroth concept insofar as Notio ordering is concerned. TBD: A logical intermediate would be a method which permits a concept to be specified as the target concept. There may of course be more than one of the same concept in a given graph though.

getConcepts

public ListType getConcepts()
Returns a list of all concepts in this graph.

getRelations

public ListType getRelations()
Returns a list of lists each of which is headed by a relation name, followed by a list of input concepts, and a list of output concepts.

getActors

public ListType getActors()
Returns a list of lists each of which is headed by a actor name, followed by a list of input concepts, and a list of output concepts.

copy

public GraphType copy()
Make a copy of this graph.

nocomments

public GraphType nocomments()
Make a copy of this graph without comments.

add

public Type add(GraphType extraGraph)
Add to a copy of this graph and return it. Relations and concepts are copied to avoid *AddError exceptions. Rules of Inference such as iteration require that a graph component can be duplicated.

This may be too minimal, i.e. may require more checks. Indeed, this function is considered very experimental.


project

public Type project(GraphType filterGraph)
Project the specified graph onto this graph, returning the projection as a new graph, or undefined. The parameter can be seen as a filter which will be applied to this graph.
See Also:
GraphType.project(Graph)

join

public Type join(GraphType g)
Join operation. Attempt to join the specified graph onto this graph and return the result.
See Also:
GraphType.join(Graph)

joinAtHead

public Type joinAtHead(GraphType g)
Join at head concepts operation. Attempt to join the specified graph onto this graph and return the result.
See Also:
GraphType.joinAtHead(Graph)