java.lang.Object
org.openprovenance.prov.model.IndexedDocument
- All Implemented Interfaces:
StatementAction
This class provides a set of indexes over information contained in
an Document, facilitating its navigation. Its constructor takes an
Document builds an index for it. Of course, for the index to be
maintained, one cannot access, say the list of edges, and mutate
it. Instead, one has to use the add methods provided.
Note that code is not thread-safe. TODO: index annotation, index edges
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedDocument(ProvFactory pFactory, Document doc) IndexedDocument(ProvFactory pFactory, Document doc, boolean flatten) -
Method Summary
Modifier and TypeMethodDescriptionadd(ActedOnBehalfOf act) add(AlternateOf alt) add(QualifiedName name, Activity activity) add(QualifiedName name, Agent agent) add(QualifiedName name, Entity entity) add(SpecializationOf spec) add(WasAssociatedWith waw) add(WasAttributedTo wat) add(WasDerivedFrom wdf) add(WasEndedBy web) add(WasGeneratedBy wgb) add(WasInfluencedBy winf) add(WasInformedBy wib) add(WasInvalidatedBy wib) add(WasStartedBy wsb) <T extends Relation>
Tadd(T statement, int num, Collection<T> anonRelationCollection, HashMap<QualifiedName, Collection<T>> namedRelationMap, HashMap<QualifiedName, Collection<T>> effectRelationMap, HashMap<QualifiedName, Collection<T>> causeRelationMap) Add an edge to the graph.voidvoidvoidvoidvoidvoidvoidvoiddoAction(Bundle bun, ProvUtilities provUtilities) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidgetActivity(QualifiedName name) getAgent(QualifiedName name) getEntity(QualifiedName name) getUsed()Return all used edges for this graph.Return all used edges with activity p as an effect.Return all used edges with entity a as a cause.Return all WasAssociatedWith edges for this graph.Return all WasAssociatedWith edges with activity p as an effect.Return all WasAssociatedWith edges with entity a as a cause.Return all WasDerivedFrom edges for this graph.Return all WasDerivedFrom edges with entity a as a cause.Return all WasDerivedFrom edges with entity a as an effect.Return all WasGeneratedBy edges for this graph.Return all WasGeneratedBy edges with activity p as an effect.Return all WasGeneratedBy edges with entity a as a cause.Return all WasInformedBy edges for this graph.Return all WasInformedBy edges with activity p as a cause.Return all WasInformedBy edges with activity a as an effect.This function allows a document to be merged with this IndexedDocument.Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasAttributedTo>> traverseAttributions2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasAttributedTo>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasAttributedTo>> traverseDerivations1(Set<QualifiedName> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasDerivedFrom>> traverseDerivations2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasDerivedFrom>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasDerivedFrom>> Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> traverseMembership2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> traverseReverseMembership2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, SpecializationOf>> traverseSpecializations2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, SpecializationOf>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, SpecializationOf>>
-
Constructor Details
-
IndexedDocument
-
IndexedDocument
-
-
Method Details
-
getUsed
Return all used edges for this graph.- Returns:
- a collection of
Usededges
-
getUsed
Return all used edges with activity p as an effect.- Parameters:
p- an activity- Returns:
- a collection of
Usededges
-
getUsed
Return all used edges with entity a as a cause.- Parameters:
p- an entity- Returns:
- a collection of
Usededges
-
getWasGeneratedBy
Return all WasGeneratedBy edges for this graph.- Returns:
- a collection of
WasGeneratedByedges
-
getWasGeneratedBy
Return all WasGeneratedBy edges with activity p as an effect.- Parameters:
p- an activty- Returns:
- a collection of
WasGeneratedByedges
-
getWasGeneratedBy
Return all WasGeneratedBy edges with entity a as a cause.- Parameters:
p- an entity- Returns:
- a collection of
WasGeneratedByedges
-
getWasDerivedFrom
Return all WasDerivedFrom edges for this graph.- Returns:
- a collection of
WasGeneratedByedges
-
getWasDerivedFromWithCause
Return all WasDerivedFrom edges with entity a as a cause.- Parameters:
a- an entity- Returns:
- a collection of
WasDerivedFromedges
-
getWasDerivedFromWithEffect
Return all WasDerivedFrom edges with entity a as an effect.- Parameters:
a- an entity- Returns:
- a collection of
WasDerivedFromedges
-
getWasInformedBy
Return all WasInformedBy edges for this graph.- Returns:
- a collection of
WasInformedByedges
-
getWasInformedByWithCause
Return all WasInformedBy edges with activity p as a cause.- Parameters:
a- an activity- Returns:
- a collection of
WasInformedByedges
-
getWasInformedByWithEffect
Return all WasInformedBy edges with activity a as an effect.- Parameters:
a- an activity- Returns:
- a collection of
WasInformedByedges
-
getWasAssociatedWith
Return all WasAssociatedWith edges for this graph.- Returns:
- a collection of
WasAssociatedWithedges
-
getWasAssociatedWith
Return all WasAssociatedWith edges with activity p as an effect.- Parameters:
p- an activity- Returns:
- a collection of
WasAssociatedWithedges
-
getWasAssociatedWith
Return all WasAssociatedWith edges with entity a as a cause.- Parameters:
a- an agent- Returns:
- a collection of
WasAssociatedWithedges
-
add
-
add
-
add
-
add
-
add
-
add
-
getActivity
-
getEntity
-
getAgent
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
-
add
public <T extends Relation> T add(T statement, int num, Collection<T> anonRelationCollection, HashMap<QualifiedName, Collection<T>> namedRelationMap, HashMap<QualifiedName, Collection<T>> effectRelationMap, HashMap<QualifiedName, Collection<T>> causeRelationMap) Add an edge to the graph. Update namedRelationMap, effectRelationMap and causeRelationMap, accordingly. Edges with different attributes are considered distinct.- Type Parameters:
T- the type of the edge to be added- Parameters:
statement- the edge to be addednum- an integeranonRelationCollection- the collection of anonymous edgesnamedRelationMap- the collection of named edgeseffectRelationMap- the collection of edges indexed by their effectcauseRelationMap- the collection of edges indexed by their cause- Returns:
- the edge that was added
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
doAction
- Specified by:
doActionin interfaceStatementAction
-
toDocument
-
merge
This function allows a document to be merged with this IndexedDocument. If flatten is true, bundles include in the document will be flattend into this one.- Parameters:
doc- the document to be merged into this- Returns:
- this indexed document
-
traverseDerivations
-
traverseDerivations1
public Set<QualifiedName> traverseDerivations1(Set<QualifiedName> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
traverseDerivationsWithRelations
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,WasDerivedFrom>> traverseDerivationsWithRelations(QualifiedName from) -
traverseDerivations2
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,WasDerivedFrom>> traverseDerivations2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasDerivedFrom>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
traverseAttributionsWithRelations
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,WasAttributedTo>> traverseAttributionsWithRelations(QualifiedName from) -
traverseAttributions2
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,WasAttributedTo>> traverseAttributions2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, WasAttributedTo>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
traverseMembershipsWithRelations
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,HadMember>> traverseMembershipsWithRelations(QualifiedName from) -
traverseMembership2
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,HadMember>> traverseMembership2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
traverseReverseMembershipsWithRelations
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,HadMember>> traverseReverseMembershipsWithRelations(QualifiedName from) -
traverseReverseMembership2
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,HadMember>> traverseReverseMembership2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, HadMember>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
traverseSpecializationsWithRelations
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,SpecializationOf>> traverseSpecializationsWithRelations(QualifiedName from) -
traverseSpecializations2
public Set<org.apache.commons.lang3.tuple.Pair<QualifiedName,SpecializationOf>> traverseSpecializations2(Set<org.apache.commons.lang3.tuple.Pair<QualifiedName, SpecializationOf>> last, Set<QualifiedName> seen, Stack<QualifiedName> todo) -
getEntities
-
getActivities
-
getAgents
-
checkActivityUsedMap
public void checkActivityUsedMap() -
checkEntityWasGeneratedByMap
public void checkEntityWasGeneratedByMap() -
checkEntityCauseWasDerivedFromMap
public void checkEntityCauseWasDerivedFromMap()
-