Search in sources :

Example 1 with SourceDocument

use of de.catma.repository.git.graph.NodeType.SourceDocument in project catma by forTEXT.

the class TPGraphProjectHandler method removeTagReferences.

@Override
public void removeTagReferences(String rootRevisionHash, AnnotationCollection collection, List<TagReference> tagReferences) throws Exception {
    logger.info("Removing " + tagReferences.size() + " references, graph size: " + graph);
    Set<String> tagInstanceIds = tagReferences.stream().map(tr -> tr.getTagInstanceId()).collect(Collectors.toSet());
    GraphTraversalSource g = graph.traversal();
    g.V().has(nt(ProjectRevision), "revisionHash", rootRevisionHash).outE(rt(hasDocument)).inV().has(nt(SourceDocument), "documentId", collection.getSourceDocumentId()).outE(rt(hasCollection)).inV().has(nt(MarkupCollection), "collectionId", collection.getId()).outE(rt(hasInstance)).inV().has(nt(TagInstance), "tagInstanceId", P.within(tagInstanceIds)).store("instances").outE(rt(hasProperty)).inV().drop().cap("instances").unfold().drop().iterate();
    logger.info("Finished removing " + tagReferences.size() + " references, graph size: " + graph);
}
Also used : Term(de.catma.repository.git.graph.NodeType.Term) ArrayListMultimap(com.google.common.collect.ArrayListMultimap) Graph(org.apache.tinkerpop.gremlin.structure.Graph) RelationType.rt(de.catma.repository.git.graph.RelationType.rt) TinkerGraph(org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph) MarkupCollection(de.catma.repository.git.graph.NodeType.MarkupCollection) Tagset(de.catma.repository.git.graph.NodeType.Tagset) HashMultimap(com.google.common.collect.HashMultimap) FileInfoProvider(de.catma.repository.git.graph.FileInfoProvider) Map(java.util.Map) TagInstance(de.catma.repository.git.graph.NodeType.TagInstance) RelationType.hasProperty(de.catma.repository.git.graph.RelationType.hasProperty) Path(java.nio.file.Path) P(org.apache.tinkerpop.gremlin.process.traversal.P) RelationType.hasInstance(de.catma.repository.git.graph.RelationType.hasInstance) Tag(de.catma.repository.git.graph.NodeType.Tag) ExecutionListener(de.catma.backgroundservice.ExecutionListener) Property(de.catma.repository.git.graph.NodeType.Property) Collection(java.util.Collection) Set(java.util.Set) TagInstance(de.catma.tag.TagInstance) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) Logger(java.util.logging.Logger) Collectors(java.util.stream.Collectors) ProjectReference(de.catma.project.ProjectReference) TagReference(de.catma.document.annotation.TagReference) ProjectRevision(de.catma.repository.git.graph.NodeType.ProjectRevision) List(java.util.List) TagDefinition(de.catma.tag.TagDefinition) RelationType.hasPosition(de.catma.repository.git.graph.RelationType.hasPosition) RelationType.isPartOf(de.catma.repository.git.graph.RelationType.isPartOf) ContentInfoSet(de.catma.document.source.ContentInfoSet) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) PropertyDefinition(de.catma.tag.PropertyDefinition) TagManager(de.catma.tag.TagManager) CommentProvider(de.catma.repository.git.graph.CommentProvider) Multimap(com.google.common.collect.Multimap) Supplier(java.util.function.Supplier) User(de.catma.user.User) SourceDocument(de.catma.repository.git.graph.NodeType.SourceDocument) NodeType.nt(de.catma.repository.git.graph.NodeType.nt) TagsetDefinition(de.catma.tag.TagsetDefinition) Pair(de.catma.util.Pair) AnnotationProperty(de.catma.repository.git.graph.NodeType.AnnotationProperty) TagLibrary(de.catma.tag.TagLibrary) ProgressListener(de.catma.backgroundservice.ProgressListener) RelationType.hasTagset(de.catma.repository.git.graph.RelationType.hasTagset) Property(de.catma.tag.Property) RelationType.hasDocument(de.catma.repository.git.graph.RelationType.hasDocument) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) RelationType.hasTag(de.catma.repository.git.graph.RelationType.hasTag) SourceDocument(de.catma.document.source.SourceDocument) AnnotationCollection(de.catma.document.annotation.AnnotationCollection) GraphTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal) Position(de.catma.repository.git.graph.NodeType.Position) Indexer(de.catma.indexer.Indexer) GraphProjectHandler(de.catma.repository.git.graph.GraphProjectHandler) RelationType.hasCollection(de.catma.repository.git.graph.RelationType.hasCollection) BackgroundService(de.catma.backgroundservice.BackgroundService) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource)

Aggregations

ArrayListMultimap (com.google.common.collect.ArrayListMultimap)1 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 BackgroundService (de.catma.backgroundservice.BackgroundService)1 ExecutionListener (de.catma.backgroundservice.ExecutionListener)1 ProgressListener (de.catma.backgroundservice.ProgressListener)1 AnnotationCollection (de.catma.document.annotation.AnnotationCollection)1 AnnotationCollectionReference (de.catma.document.annotation.AnnotationCollectionReference)1 TagReference (de.catma.document.annotation.TagReference)1 ContentInfoSet (de.catma.document.source.ContentInfoSet)1 SourceDocument (de.catma.document.source.SourceDocument)1 Indexer (de.catma.indexer.Indexer)1 ProjectReference (de.catma.project.ProjectReference)1 CommentProvider (de.catma.repository.git.graph.CommentProvider)1 FileInfoProvider (de.catma.repository.git.graph.FileInfoProvider)1 GraphProjectHandler (de.catma.repository.git.graph.GraphProjectHandler)1 AnnotationProperty (de.catma.repository.git.graph.NodeType.AnnotationProperty)1 MarkupCollection (de.catma.repository.git.graph.NodeType.MarkupCollection)1 Position (de.catma.repository.git.graph.NodeType.Position)1 ProjectRevision (de.catma.repository.git.graph.NodeType.ProjectRevision)1