Search in sources :

Example 1 with AtlasSchemaViolationException

use of org.apache.atlas.repository.graphdb.AtlasSchemaViolationException in project atlas by apache.

the class AtlasJanusGraph method addEdge.

@Override
public AtlasEdge<AtlasJanusVertex, AtlasJanusEdge> addEdge(AtlasVertex<AtlasJanusVertex, AtlasJanusEdge> outVertex, AtlasVertex<AtlasJanusVertex, AtlasJanusEdge> inVertex, String edgeLabel) {
    try {
        Vertex oV = outVertex.getV().getWrappedElement();
        Vertex iV = inVertex.getV().getWrappedElement();
        Edge edge = oV.addEdge(edgeLabel, iV);
        return GraphDbObjectFactory.createEdge(this, edge);
    } catch (SchemaViolationException e) {
        throw new AtlasSchemaViolationException(e);
    }
}
Also used : Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) AtlasVertex(org.apache.atlas.repository.graphdb.AtlasVertex) AtlasSchemaViolationException(org.apache.atlas.repository.graphdb.AtlasSchemaViolationException) SchemaViolationException(org.janusgraph.core.SchemaViolationException) AtlasSchemaViolationException(org.apache.atlas.repository.graphdb.AtlasSchemaViolationException) AtlasEdge(org.apache.atlas.repository.graphdb.AtlasEdge) Edge(org.apache.tinkerpop.gremlin.structure.Edge)

Example 2 with AtlasSchemaViolationException

use of org.apache.atlas.repository.graphdb.AtlasSchemaViolationException in project incubator-atlas by apache.

the class TypedInstanceToGraphMapper method addOrUpdateAttributesAndTraits.

private List<String> addOrUpdateAttributesAndTraits(Operation operation, List<ITypedReferenceableInstance> instances) throws AtlasException {
    List<String> guids = new ArrayList<>();
    for (ITypedReferenceableInstance instance : instances) {
        try {
            // new vertex, set all the properties
            String guid = addOrUpdateAttributesAndTraits(operation, instance);
            guids.add(guid);
        } catch (AtlasSchemaViolationException e) {
            throw new EntityExistsException(instance, e);
        }
    }
    return guids;
}
Also used : ITypedReferenceableInstance(org.apache.atlas.typesystem.ITypedReferenceableInstance) ArrayList(java.util.ArrayList) AtlasSchemaViolationException(org.apache.atlas.repository.graphdb.AtlasSchemaViolationException) EntityExistsException(org.apache.atlas.typesystem.exception.EntityExistsException)

Example 3 with AtlasSchemaViolationException

use of org.apache.atlas.repository.graphdb.AtlasSchemaViolationException in project incubator-atlas by apache.

the class Titan1Graph method addEdge.

@Override
public AtlasEdge<Titan1Vertex, Titan1Edge> addEdge(AtlasVertex<Titan1Vertex, Titan1Edge> outVertex, AtlasVertex<Titan1Vertex, Titan1Edge> inVertex, String edgeLabel) {
    try {
        Vertex oV = outVertex.getV().getWrappedElement();
        Vertex iV = inVertex.getV().getWrappedElement();
        Edge edge = oV.addEdge(edgeLabel, iV);
        return GraphDbObjectFactory.createEdge(this, edge);
    } catch (SchemaViolationException e) {
        throw new AtlasSchemaViolationException(e);
    }
}
Also used : Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) AtlasVertex(org.apache.atlas.repository.graphdb.AtlasVertex) AtlasSchemaViolationException(org.apache.atlas.repository.graphdb.AtlasSchemaViolationException) SchemaViolationException(com.thinkaurelius.titan.core.SchemaViolationException) AtlasSchemaViolationException(org.apache.atlas.repository.graphdb.AtlasSchemaViolationException) AtlasEdge(org.apache.atlas.repository.graphdb.AtlasEdge) Edge(org.apache.tinkerpop.gremlin.structure.Edge)

Aggregations

AtlasSchemaViolationException (org.apache.atlas.repository.graphdb.AtlasSchemaViolationException)3 AtlasEdge (org.apache.atlas.repository.graphdb.AtlasEdge)2 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)2 Edge (org.apache.tinkerpop.gremlin.structure.Edge)2 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)2 SchemaViolationException (com.thinkaurelius.titan.core.SchemaViolationException)1 ArrayList (java.util.ArrayList)1 ITypedReferenceableInstance (org.apache.atlas.typesystem.ITypedReferenceableInstance)1 EntityExistsException (org.apache.atlas.typesystem.exception.EntityExistsException)1 SchemaViolationException (org.janusgraph.core.SchemaViolationException)1