Search in sources :

Example 6 with EdgeInfo

use of org.vertexium.accumulo.iterator.model.EdgeInfo in project vertexium by visallo.

the class ElementMutationBuilder method alterEdgeVertexInVertex.

public boolean alterEdgeVertexInVertex(Mutation vertexInMutation, Edge edge, Visibility newVisibility) {
    ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
    ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
    if (currentColumnVisibility.equals(newColumnVisibility)) {
        return false;
    }
    EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.OUT));
    vertexInMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), currentColumnVisibility);
    vertexInMutation.put(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
    return true;
}
Also used : Text(org.apache.hadoop.io.Text) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) EdgeInfo(org.vertexium.accumulo.iterator.model.EdgeInfo)

Example 7 with EdgeInfo

use of org.vertexium.accumulo.iterator.model.EdgeInfo in project vertexium by visallo.

the class ElementMutationBuilder method getVertexTableKeyValuePairsEdge.

public Iterable<KeyValuePair> getVertexTableKeyValuePairsEdge(AccumuloEdge edge) {
    List<KeyValuePair> results = new ArrayList<>();
    ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
    String edgeLabel = edge.getNewEdgeLabel() != null ? edge.getNewEdgeLabel() : edge.getLabel();
    Text edgeIdText = new Text(edge.getId());
    long timestamp = edge.getTimestamp();
    // out vertex.
    Text vertexOutIdRowKey = new Text(edge.getVertexId(Direction.OUT));
    org.vertexium.accumulo.iterator.model.EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edgeLabel), edge.getVertexId(Direction.IN));
    results.add(new KeyValuePair(new Key(vertexOutIdRowKey, AccumuloVertex.CF_OUT_EDGE, edgeIdText, edgeColumnVisibility, timestamp), edgeInfo.toValue()));
    // in vertex.
    Text vertexInIdRowKey = new Text(edge.getVertexId(Direction.IN));
    edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edgeLabel), edge.getVertexId(Direction.OUT));
    results.add(new KeyValuePair(new Key(vertexInIdRowKey, AccumuloVertex.CF_IN_EDGE, edgeIdText, edgeColumnVisibility, timestamp), edgeInfo.toValue()));
    return results;
}
Also used : ArrayList(java.util.ArrayList) Text(org.apache.hadoop.io.Text) EdgeInfo(org.vertexium.accumulo.iterator.model.EdgeInfo) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) EdgeInfo(org.vertexium.accumulo.iterator.model.EdgeInfo) Key(org.apache.accumulo.core.data.Key)

Example 8 with EdgeInfo

use of org.vertexium.accumulo.iterator.model.EdgeInfo in project vertexium by visallo.

the class ElementMutationBuilder method alterEdgeVertexOutVertex.

public boolean alterEdgeVertexOutVertex(Mutation vertexOutMutation, Edge edge, Visibility newVisibility) {
    ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
    ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
    if (currentColumnVisibility.equals(newColumnVisibility)) {
        return false;
    }
    EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.IN));
    vertexOutMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility);
    vertexOutMutation.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
    return true;
}
Also used : Text(org.apache.hadoop.io.Text) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) EdgeInfo(org.vertexium.accumulo.iterator.model.EdgeInfo)

Aggregations

Text (org.apache.hadoop.io.Text)8 EdgeInfo (org.vertexium.accumulo.iterator.model.EdgeInfo)8 Key (org.apache.accumulo.core.data.Key)4 ColumnVisibility (org.apache.accumulo.core.security.ColumnVisibility)3 Value (org.apache.accumulo.core.data.Value)2 ArrayList (java.util.ArrayList)1 Mutation (org.apache.accumulo.core.data.Mutation)1 PartialKey (org.apache.accumulo.core.data.PartialKey)1 Span (org.apache.accumulo.core.trace.Span)1 Test (org.junit.Test)1 IteratorFetchHints (org.vertexium.accumulo.iterator.model.IteratorFetchHints)1 SoftDeleteEdgeInfo (org.vertexium.accumulo.iterator.model.SoftDeleteEdgeInfo)1 DataTableRowKey (org.vertexium.accumulo.keys.DataTableRowKey)1 StreamingPropertyValue (org.vertexium.property.StreamingPropertyValue)1 IndexHint (org.vertexium.search.IndexHint)1