-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting different node and edge types #282
Comments
I'm not sure what you mean by "acceptable". It does make sense to consider restricted forms of the
It depends on specifics but I expect that the algebra will change pretty dramatically.
Not at the moment. |
Apart from the simplest case with two vertex types, of course. For that we have |
Many real world knowledge graphs will be "mixed graphs", in the sense that they contain different types of nodes connected via different types of edges. Usually such graphs will assume (at least implicitly) some kind of schema that restricts edge types regarding the types of nodes it is allowed to connect. A way to think about this is that every possible edge label is equipped with a predicate on allowed source and target nodes. Of course other encodings of such a simple schema are possible, too. Now of course one could simply defined connect to only connect pairs of nodes that satisfy the predicate associated with the edge label. How many of the laws of the algebra are lost if one does this though? A second question would be how to make that happen in alga but I take your reply to mean that something like this is currently not supported directly. |
@boggle Supporting what you describe in full generality is going to be hard, most likely impractical in a language like Haskell, because you'll have to encode these edge-vertex compatibility predicates in types. You probably want a languages with full dependent types for that, like Agda. A weaker version of what you describe can be achieved by simply using the edge-labelled version of the algebra, where you will attach the predicate to every edge as a label. Then one could construct invalid graphs using the API but it would also be possible to run a validation procedure that checks that every edge satisfies its compatibility predicate. Not sure if this is good enough for you but I don't know how to provide anything better. Happy to keep this issue open in case anyone comes up with a viable approach. |
Interesting, so I understand you to suggest to rather limit the set of valid expressions of the algebra instead of modifying the algebra itself to implicitly uphold schema (e.g. by only creating valid edges). That makes a lot of sense; this way none of the laws of the algebra are invalidated. |
I don't think I suggested that. By limiting the set of valid expressions we are most certainly going to modify the algebra. For example, if we no longer allow |
What I meant was: This way none of the laws of the algebra prior to the use of the invalidation procedure are invalidated. On a second thought, maybe this isn't such a big difference. |
Given a graph with different node types (say "a", "b", "c", etc.) and different edge types ("r", "s", "t"), is it acceptable to modify connect such that the edge type determines the types of source and target nodes that will be connected (ignoring other nodes)? What does making such a change do to the algebra? Is there anything in alga that would help building such graphs?
The text was updated successfully, but these errors were encountered: