Package org.openprovenance.prov.model
Class IndexedDocument
- java.lang.Object
-
- org.openprovenance.prov.model.IndexedDocument
-
- All Implemented Interfaces:
StatementAction
public class IndexedDocument extends Object implements 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
Constructors Constructor Description IndexedDocument(ProvFactory pFactory, Document doc)
IndexedDocument(ProvFactory pFactory, Document doc, boolean flatten)
-
Method Summary
-
-
-
Constructor Detail
-
IndexedDocument
public IndexedDocument(ProvFactory pFactory, Document doc)
-
IndexedDocument
public IndexedDocument(ProvFactory pFactory, Document doc, boolean flatten)
-
-
Method Detail
-
getUsed
public Collection<Used> getUsed()
Return all used edges for this graph.
-
getUsed
public Collection<Used> getUsed(Activity p)
Return all used edges with activity p as an effect.
-
getUsed
public Collection<Used> getUsed(Entity p)
Return all used edges with entity a as a cause.
-
getWasGeneratedBy
public Collection<WasGeneratedBy> getWasGeneratedBy()
Return all WasGeneratedBy edges for this graph.
-
getWasGeneratedBy
public Collection<WasGeneratedBy> getWasGeneratedBy(Activity p)
Return all WasGeneratedBy edges with activity p as an effect.
-
getWasGeneratedBy
public Collection<WasGeneratedBy> getWasGeneratedBy(Entity p)
Return all WasGeneratedBy edges with entity a as a cause.
-
getWasDerivedFrom
public Collection<WasDerivedFrom> getWasDerivedFrom()
Return all WasDerivedFrom edges for this graph.
-
getWasDerivedFromWithCause
public Collection<WasDerivedFrom> getWasDerivedFromWithCause(Entity a)
Return all WasDerivedFrom edges with entity a as a cause.
-
getWasDerivedFromWithEffect
public Collection<WasDerivedFrom> getWasDerivedFromWithEffect(Entity a)
Return all WasDerivedFrom edges with entity a as an effect .
-
getWasInformedBy
public Collection<WasInformedBy> getWasInformedBy()
Return all WasInformedBy edges for this graph.
-
getWasInformedByWithCause
public Collection<WasInformedBy> getWasInformedByWithCause(Activity a)
Return all WasInformedBy edges with activity p as a cause.
-
getWasInformedByWithEffect
public Collection<WasInformedBy> getWasInformedByWithEffect(Activity a)
Return all WasInformedBy edges with activity a as an effect.
-
getWasAssociatedWith
public Collection<WasAssociatedWith> getWasAssociatedWith()
Return all WasAssociatedWith edges for this graph.
-
getWasAssociatedWith
public Collection<WasAssociatedWith> getWasAssociatedWith(Activity p)
Return all WasAssociatedWith edges with activity p as an effect.
-
getWasAssociatedWith
public Collection<WasAssociatedWith> getWasAssociatedWith(Agent a)
Return all WasAssociatedWith edges with entity a as a cause.
-
add
public Entity add(QualifiedName name, Entity entity)
-
add
public Agent add(QualifiedName name, Agent agent)
-
add
public Activity add(QualifiedName name, Activity activity)
-
add
public WasInformedBy add(WasInformedBy wib)
-
add
public WasGeneratedBy add(WasGeneratedBy wgb)
-
add
public WasDerivedFrom add(WasDerivedFrom wdf)
-
add
public WasAssociatedWith add(WasAssociatedWith waw)
-
add
public WasAttributedTo add(WasAttributedTo wat)
-
add
public ActedOnBehalfOf add(ActedOnBehalfOf act)
-
add
public WasInvalidatedBy add(WasInvalidatedBy wib)
-
add
public SpecializationOf add(SpecializationOf spec)
-
add
public AlternateOf add(AlternateOf alt)
-
add
public WasInfluencedBy add(WasInfluencedBy winf)
-
add
public WasStartedBy add(WasStartedBy wsb)
-
add
public WasEndedBy add(WasEndedBy web)
-
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.
-
doAction
public void doAction(Activity s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(Used s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasStartedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(Agent s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(AlternateOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasAssociatedWith s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasAttributedTo s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasInfluencedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(ActedOnBehalfOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasDerivedFrom s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasEndedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(Entity s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasGeneratedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasInvalidatedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(HadMember s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(MentionOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(SpecializationOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(QualifiedSpecializationOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(QualifiedAlternateOf s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(QualifiedHadMember s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(WasInformedBy s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(DerivedByInsertionFrom s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(DictionaryMembership s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(DerivedByRemovalFrom s)
- Specified by:
doAction
in interfaceStatementAction
-
doAction
public void doAction(Bundle bun, ProvUtilities provUtilities)
- Specified by:
doAction
in interfaceStatementAction
-
toDocument
public Document toDocument()
-
merge
public void merge(Document doc)
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 merge into this
-
traverseDerivations
public Set<QualifiedName> traverseDerivations(QualifiedName from)
-
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)
-
-