Syncleus / Ferma

An ORM / OGM for the TinkerPop graph stack.
http://syncleus.com/Ferma
Apache License 2.0
136 stars 26 forks source link

Ability to add keyValues on Edge and Vertex Creation #55

Open kevmegforest opened 5 years ago

kevmegforest commented 5 years ago

I've got a bug with fields which are mandatory for classes.

I'm trying to create an Edge on an existing vertex using

        edgeHasCalculs= COP_Vertex.addEdgeToExistingVStoreLocation(storeVertex, calculs.INITIALIZER_EHasCalculs);
        edgeHasCalculs.setTypeCalcul(classOf[VCOP].getSimpleName);
        edgeHasCalculs.setTimespan(timespan);
        edgeHasCalculs.setEnd_Date(endDate.toDate());

It fails at the first line, because of : "The field 'EHasCalculs.Timespan' is mandatory, but not found on record: EHasCalculs{out:#-1:-2,in:#21:2}"

I would need to be able to specify the keyValues on creation of the baseEdge so that when it goes in the delegatingFrameGraph, the classInitializer or an other way be able to specify keyValues in this function.

public <T> T addFramedEdge(final VertexFrame source, final VertexFrame destination, final String label, final ClassInitializer<T> initializer, final Object... keyValues) {

        final Edge baseEdge = source.getElement().addEdge(label, destination.getElement(), keyValues);
        final T framedEdge = frameNewElement(baseEdge, initializer);
        return framedEdge;

    }

I'm using the annotation methods:

@Incidence(label = "EHasCalculs", direction = Direction.OUT)
    public abstract <E extends AbstractEdgeFrame> E addEdgeToExistingVStoreLocation(VStoreLocation son, ClassInitializer<? extends E> edgeInitializer);

Thanks

syncleus-bot commented 5 years ago

I'll look into this shortly, not near a computer right now. Give me 24 hours for a proper response thanks.

On Tue, Dec 18, 2018, 3:16 PM kevmegforest <notifications@github.com wrote:

I've got a bug with fields which are mandatory for classes.

I'm trying to create an Edge on an existing vertex using

edgeHasCalculs= COP_Vertex.addEdgeToExistingVStoreLocation(storeVertex, calculs.INITIALIZER_EHasCalculs); edgeHasCalculs.setTypeCalcul(classOf[VCOP].getSimpleName); edgeHasCalculs.setTimespan(timespan); edgeHasCalculs.setEnd_Date(endDate.toDate());

It fails at the first line, because of : "The field 'EHasCalculs.Timespan' is mandatory, but not found on record: EHasCalculs{out:#-1:-2,in:#21 https://github.com/Syncleus/Ferma/issues/21:2}"

I would need to be able to specify the keyValues on creation of the baseEdge so that when it goes in the delegatingFrameGraph, the classInitializer or an other way be able to specify keyValues in this function. public T addFramedEdge(final VertexFrame source, final VertexFrame destination, final String label, final ClassInitializer initializer, final Object... keyValues) { final Edge baseEdge = source.getElement().addEdge(label, destination.getElement(), keyValues); final T framedEdge = frameNewElement(baseEdge, initializer); return framedEdge; }

I'm using the annotation methods:

@Incidence(label = "EHasCalculs", direction = Direction.OUT) public abstract E addEdgeToExistingVStoreLocation(VStoreLocation son, ClassInitializer<? extends E> edgeInitializer);

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/Ferma/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AWNYby8hCqyYYkwev5WaNyxoYBibYyMuks5u6U00gaJpZM4ZZAb4 .