question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LINK type constraints on lightweight edges

See original GitHub issue

Is it possible to create LINK type constraints on a lightweight edge? I am running OrientDB 2.1.11, and I set my edges to be lightweight using the command ALTER DATABASE CUSTOM useLightWeightEdges = TRUE The following is an example of what I would like to be able to do.

I first ran the following SQL commands CREATE CLASS C1 EXTENDS V CREATE CLASS C2 EXTENDS V

CREATE CLASS E1 EXTENDS E CREATE PROPERTY E1.out LINK C1 CREATE PROPERTY E1.in LINK C1

CREATE VERTEX C1 set id="c11" CREATE VERTEX C1 set id="c12 CREATE VERTEX C2 set id="c2

After all that, now running CREATE EDGE E1 FROM (SELECT FROM C1 WHERE "id" = "c11") TO (SELECT FROM C2 WHERE "id" = "c2") does not throw any exceptions, and creates the edge as requested. Is there any reason why a lightweight edge cannot enforce LINK type constraints? If I make E1 a “normal” edge then the constraint is enforced and I get thrown an OValidationException as I expected. Is creating a normal edge the only solution to my problem? Can lightweight edges also be configured to enforce such constraints?

I should mention, when I type INFO CLASS E1 the LINK type constraint does show up on the output, which suggests to me that the constraint information for the lightweight edge is maintained by the database, even if not ultimately enforced. Thanks for any comments.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
codelimnercommented, Apr 5, 2016

Thanks @smolinari and @nagarajasr for the comments and additional information.

I did some investigation on this looking into the source code for version 2.1.14 during the past couple of days. Essentially, all schema constraints (including LINK type) are completely ignored when the lightweightedges option for the db is set to “true”. This is what @nagarajasr was implying I suppose, and you can observe this in the code by looking at the implementation of getType() method of the OrientEdge class.

But you can’t also set these constraints on the two endpoint vertex classes. I feel this is reasonable as it is an edge type constraint, and it would not make sense to set constraints on the vertex end points without the edge being involved in any way.

So if my understanding is correct, this is more of a “not implemented now” thing (if it will ever be) rather than a bug. Part of the problem with implementing this seems to be that the constraint validation checks are done at a document level, and of course lightweight edges have no document by themselves. Validating a lightweight edge is really validating a property of another document (link property of either the out or in vertex), and may need a special case handling.

0reactions
smolinaricommented, Apr 5, 2016

Thanks Luigi,

I believe we are only looking for the constraint between two vertex classes being upheld properly. In other words (using this section of the docs for an example).

http://orientdb.com/docs/2.1/Tutorial-Using-schema-with-graphs.html#using-in-and-out-constraints-on-edges

The control should not only be the direction of the edge (a car can’t own a person), but the fact that an “owns” edge can only be used between the “person” and “car” classes. If I would want to have multiple “owns” edges to other classes, then I wouldn’t add the “owns.in” property.

I hope that makes sense.

Scott

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lightweight Edges · OrientDB Manual
In OrientDB Graph databases, there are two types of edges available: ... The advantage of Lightweight Edges lies in performance and disk usage....
Read more >
Lightweight Edges · OrientDB Manual
OrientDB supports Lightweight Edges as regular edges, but without an identity on database. Lightweight edges can be used only when no properties are...
Read more >
Build a Responsive UI with ConstraintLayout
Each constraint represents a connection or alignment to another view, the parent ... Constrain the side of a view to the corresponding edge...
Read more >
Ultra-Lightweight Constraints Paper - College of Computing
These ultra-lightweight constraints, while not handling all cases, cover most relationships used for layout, and allow conventional constraints to be ...
Read more >
graph theory - Why are my edges returning content rather than RIDs ...
First I thought some of the edges had been saved as lightweight edges or links, but then I noticed that if I directly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found