-
Notifications
You must be signed in to change notification settings - Fork 24
GetNodesEqualsTo do not always return the proper nodes #165
Comments
Hello, |
When you ask for I also often iterate on the nodes of a subgraph to get the values of the parent, this is one major advantage of Tulip. My point is different. I understand the point on an object model perspective (returns the same pointer), I'm more talking on a code semantic one. Imagine you have |
I agree with @bpinaud, this is Tulip normal behavior and not a design flaw. The Python brackets notation is just syntactic sugar to write shorter code. But you still get a pointer to a property and it is up to the caller to filter the nodes to process when calling |
As I told earlier, it is not about the bracket, but about the getProperty
too. I understand the pointer logic, but the semantic is confusing. At
least we may raise this warning in the doc.
Le mer. 22 janv. 2020 à 22:27, Antoine Lambert <notifications@github.com> a
écrit :
I agree with @bpinaud <https://github.com/bpinaud>, this is Tulip normal
behavior and not a design flaw. The Python brackets notation is just
syntactic sugar to write shorter code. But you still get a pointer to a
property and it is up to the caller to filter the nodes to process when
calling getNodesEqualTo.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#165?email_source=notifications&email_token=AANMAFP6CFTN5GYN6J2SVCLQ7C23PA5CNFSM4KKHZ4Y2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJVFI4Y#issuecomment-577393779>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANMAFM4C7E442F62ZQ3JMLQ7C23PANCNFSM4KKHZ4YQ>
.
--
--
Benjamin
|
Indeed, the Tulip semantics are quite particular for a Python programmer. I agree that the documentation could be improved to clarify that behavior. |
Hi,
I am scouting through subgraphs and using
getNodesEqualTo
of a string property as follows:If I follow this logic, each node returned by
sg['node_type'].getNodesEqualTo(t)
should belong tosg
a subgraph ofgraph
. Unfortunately I obtained a message telling the contrary.I have further ploted the number of match in comparison to the number of nodes of my subgraph:
Which gives me:
Which can be read as:
in a subgraph titled
gender
which contains 29 nodes,I am trying to match a value
patient
,689 nodes are matching this condition.
Same if I use
getStringProperty
instead of brackets.I believe the 689 nodes to match the parent graph or the root graph.
Now this behavior can be worked around by adding the subgraph as a parameter:
sg['node_type'].getNodesEqualTo(t, sg)
(all the numbers are then correct).But is this the expected behavior? There is a subtlety I understood while writing this post that the
sg['node_type']
(orsg.getXXXProperty(YYY)
) gives you the scope in which the property was intially created. But this is conterintuitive considering that we call the accessor within the graph and not from thetlp
scope.The text was updated successfully, but these errors were encountered: