Skip to content
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

How to interpret query results. #422

Closed
Davenporten opened this issue Dec 12, 2019 · 6 comments
Closed

How to interpret query results. #422

Davenporten opened this issue Dec 12, 2019 · 6 comments

Comments

@Davenporten
Copy link

I put this on Stack Overflow, but figured it might be better to ask here:

I'm creating an interactive graph in my web page by querying my OrientDB instance using Orientjs then pulling out the needed data from the query and passing it to cytoscape.js. I'm able to get data down from the OrientDB instance and graph it, but I realized that the result of running a query in OrientDB Studio is different than when I run the query through Orientjs. In Studio I get 20 nodes with 67 edges from the query. When I run the same query through Orientjs I get 65 individual objects back. Originally I thought each object represented a node and the 'in_links'/'out_links' were the edges. However, this obviously isn't the case.

So I figure it is 1 of 3 problems:

  1. Orientjs just isn't working and is giving me back bad data (I think and hope this is unlikely).
  2. I am somehow running the query on two different instances of OrientDB (I'm pretty sure this is impossible).
  3. I am not interpreting the query results from Orientjs correctly and therefore not feeding them into cytoscape.js correctly (I think this is most likely the problem).

Here are a few examples of the objects I'm getting back from my query:

{
"@Class": "<class_name>",
"@type": "d",
"Cluster_ID": 8,
"@Rid": "#25:5",
"@Version": 1
},
{
"@Class": "<class_name>",
"@type": "d",
"out_links": [
"#33:65",
"#34:65",
"#35:65",
"#36:65",
"#33:67",
"#34:67",
"#35:67",
"#36:67",
"#33:69",
"#34:69",
"#35:69",
"#36:69",
"#33:71",
"#34:71",
"#35:71",
"#36:71",
"#36:127",
"#37:126",
"#38:126",
"#39:126",
"#40:126",
"#37:130",
"#38:129",
"#39:129",
"#40:129",
"#33:130",
"#38:133",
"#39:132",
"#40:132",
"#33:133",
"#34:133",
"#39:136",
"#40:135",
"#33:136",
"#34:136",
"#35:136"
],
"Cluster_ID": 0,
"@Rid": "#25:6",
"@Version": 9
},
{
"@Class": "<class_name>",
"@type": "d",
"Cluster_ID": 8,
"@Rid": "#25:7",
"@Version": 1
},
{
"@Class": "<class_name>",
"@type": "d",
"out_links": [
"#36:112",
"#37:112",
"#38:112",
"#39:112",
"#40:111",
"#37:115",
"#38:115",
"#39:115",
"#40:115",
"#33:115"
],
"in_links": [
"#38:95",
"#35:94",
"#40:94",
"#37:93",
"#34:93",
"#33:105",
"#38:103",
"#35:104",
"#40:102",
"#37:102"
],
"Cluster_ID": 3,
"@Rid": "#25:8",
"@Version": 5
}

Like I mentioned I thought each of these represented a node and the in/out_links were the edges. Is this correct? Or is there something I'm missing in interpreting the query results?

Thanks for all the help in advance.

@luigidellaquila
Copy link
Member

Hi @Davenporten

The difference could be due to the fact that Studio by default adds a LIMIT 20 to the queries (where a limit is not explicitly set in the query).

Thanks

Luigi

@Davenporten
Copy link
Author

Davenporten commented Dec 13, 2019

Thanks @luigidellaquila for getting back to me.

I didn't realize there was that implicit limit, but that definitely makes sense in accounting for the discrepancy. Is my interpretation of the objects correct then? Each object being a node and the in/out_links being the edges? How should the in/out_links be interpreted? It seems like it is not as simple as an in/out_link goes to another node in the query.

Thanks again!

@luigidellaquila
Copy link
Member

Hi @Davenporten

That's correct, each record is a vertex and the in/out are pointers to the edges, that are documents as well

Thanks

Luigi

@Davenporten
Copy link
Author

So would I know if two vertices are connected by looking at the in_links of one and the out_links of another? Meaning, if there is the same ID in the in_link of one vertex and the out_link of another vertex, those two vertices are connected by that edge?

Again, thanks so much for your help!

@luigidellaquila
Copy link
Member

Exactly ;-) out are outgoing edges, in are incoming edges, the same RID means the same edge

@Davenporten
Copy link
Author

Davenporten commented Dec 13, 2019

Your help has been much appreciated @luigidellaquila, really thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants