Compare node attribute

25 views
Skip to first unread message

Marc Núñez Ubach

unread,
Mar 23, 2018, 7:59:46 AM3/23/18
to Sparksee
Hi,

Is there anyway to check if a integer node attribute contains a value that is bigger than another one. 

I mean a way that it returns all the nodes OID's that the attribute x have an attribute bigger than y. What i saw is that with Graph.findObject it returns the oid given the attribute type and the exact attribute value, But there is no way to work with the given attribute value it allways have to be the exact value. 

Thanks!

Marc

c3po.ac

unread,
Mar 23, 2018, 10:18:49 AM3/23/18
to Sparksee

Hi,


You may want to take a look at the Graph.select operations:


http://www.sparsity-technologies.com/downloads/javadoc-java/html/com/sparsity/sparksee/gdb/Graph.html


For example:


Value value = new Value();
Objects someObjects = graph.select( anAttributeId, Condition.GreaterThan, value.setDouble(2.5));



Best regards



El divendres, 23 març de 2018 12:59:46 UTC+1, Marc Núñez Ubach va escriure:

Marc Núñez Ubach

unread,
Mar 26, 2018, 3:07:53 AM3/26/18
to Sparksee
Hi,

Thanks for the answere, i worked with selects, but comparing with the functions findObject and then neighbours it's quite slow. A graph data base isn't prepared to manage querys like selects, and i think that what it does is just list all the nodes and go one by one searching the coincidence of the attribute, that's why it takes so long to make and select compared to a neighbours for example. 

But if there is nothing else i guess i have no choice, or maybe i have selected incorrectly the techonogy.

Marc

El divendres, 23 març de 2018 15:18:49 UTC+1, c3po.ac va escriure:

c3po.ac

unread,
Mar 27, 2018, 4:53:34 AM3/27/18
to Sparksee
Hi,

The neighbours of a node are easy to get or even already precalculated if you have materialized the neighours for the edge type. So nothing can be as fast as getting the neighbours.

FindObject is also very fast because it only returns a single node. It's supposed to be used only with unique attributes or when you don't care which of the several nodes/edges with that attribute value you get.

But if you want a set of objects with certain values, a new temporary Objects collection must be created with all the nodes/edges that have the desired values. The time required for that depends on your search conditions, your data and the attribute kind.

Which kind of attribute are you using in the select operation?
You should never use select operations with "Basic" attributes because it will be really slow. If you need to use an attribute in a select operation, it should be indexed (or unique).

Best regards.

El dilluns, 26 març de 2018 9:07:53 UTC+2, Marc Núñez Ubach va escriure:

Marc Núñez Ubach

unread,
Apr 3, 2018, 6:20:09 AM4/3/18
to Sparksee
Hi,

Thanks this was really useful, i was using Basic types so i guess this will boost up the performance!

Kind Regards

El dimarts, 27 març de 2018 10:53:34 UTC+2, c3po.ac va escriure:
Reply all
Reply to author
Forward
0 new messages