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

Add option to include direction of relations in apoc.convert.toTree #2199

Closed
mrveld94 opened this issue Sep 8, 2021 · 3 comments
Closed

Comments

@mrveld94
Copy link

mrveld94 commented Sep 8, 2021

The output of apoc.convert.toTree does not include the direction of the relations.

For example, consider the following path.
image

I can turn this path into a tree (with the pink node as root node) using the following query.

CALL apoc.convert.toTree(path, false) YIELD output RETURN output

This results in the following json.

{
  "_type": "Resource:prov__Entity:provone__Data",
  "uri": "urn:uuid:output_adaguc_Zmax_202108091550.h5",
  "prov__hadMember": [
    {
      "_type": "Resource:prov__Entity:prov__Collection",
      "uri": "urn:uuid:output_collection_Output_202108091550",
      "prov__wasDerivedFrom": [
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_Model_202108091550"
        },
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_Radar_202108091550"
        },
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_IVS_202108091550"
        }
      ]
    }
  ]
}

Looking at this output I cannot determine if urn:uuid:output_adaguc_Zmax_202108091550.h5 <prov__hadMember urn:uuid:output_collection_Output_202108091550 or if urn:uuid:output_adaguc_Zmax_202108091550.h5 prov__hadMember> urn:uuid:output_collection_Output_202108091550.
In other words I cannot determine which entity is a member of which.

I would like to see an option in apoc.convert.toTree, which would return the direction of the relations. For example by using the following query.

CALL apoc.convert.toTree(path, false, { includeDirection: true }) YIELD output RETURN output

Which would return something like this.

{
  "_type": "Resource:prov__Entity:provone__Data",
  "uri": "urn:uuid:output_adaguc_Zmax_202108091550.h5",
  "<prov__hadMember": [
    {
      "_type": "Resource:prov__Entity:prov__Collection",
      "uri": "urn:uuid:output_collection_Output_202108091550",
      "prov__wasDerivedFrom>": [
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_Model_202108091550"
        },
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_Radar_202108091550"
        },
        {
          "_type": "Resource:prov__Entity:prov__Collection",
          "uri": "urn:uuid:input_collection_IVS_202108091550"
        }
      ]
    }
  ]
}
@conker84
Copy link
Contributor

{
  "_type": "Resource:prov__Entity:provone__Data",
  "uri": "urn:uuid:output_adaguc_Zmax_202108091550.h5",
  "prov__hadMember": [
    {
      "_type": "Resource:prov__Entity:prov__Collection",
      "_direction": "OUT",
      "uri": "urn:uuid:output_collection_Output_202108091550"
...
    }
  ]
}

@mrveld94
Copy link
Author

Yes that would be perfect. Is this something that will be in the next version?
(Sorry used the wrong account earlier...)

@mrveld94
Copy link
Author

Hi, is this something that is going to be implemented? And if so, when?

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

3 participants