Do you have plans for gpu-accelerated dgraph-ratel UI?

The speed of dgraph-ratel suffers heavily from the increase of graph size,
I’ve been searching the net for gpu-accelerated graph visualization and learned that there are some works in progress in this direction.
What’s your thoughts on this?

graph visualization is just a useful tool to visual data, it’s not necessary to use this visual too many data, try use client to query

There are graphs data viewers out there. Very good, I found a professional and free another day. So,I’ll remember the name of it and where I saved it.

I could import RDF to it and see the data and their relationships. I believe there are many viewers like that out there. Cuz RDF is an old standard of ontology. In this case I full fill the data in the DB and then exported (in RDF) to visualizing the data dynamically. The program (In Java) was possible to see in numerous styles and supports a large amount of graphs.

1 Like

But the query result is presented in json rather than rdf, is there a way to systematically transform json represented graph to rdf?

why do you want to convert json to rdf, i think json is much better to understand and for next parse

rdf is better supported by most visualization software

what visualization software do you usually use?

I tried gephi but can’t find a way to convert the dgraph return result to a suitable format,
Do you have any recommendations?

Try this What rdf files? how can i create it - #3 by MichelDiz

I have a little tutorial how to transform JSON-LD Into RDF.

use blank node insert data

Thank you for the advice, but I have a conceptual problem:
the json which is returned does not contain uid information, how does the browser determine which nodes are in fact the same node?

an example return json:

{userid: 123456
user.login{
~user.login{
userid: 123456
}
}
}

here the innermost user node is in fact the same node as the root, but we cannot tell this fact from this json only. But on the other hand dgraph-ratel seems to always know which nodes are identical.

If you ask for UID in the query fiel, you’ll have “the sure”. Ratel knows why it tends to collect the UID and then separates correctly.

If in your query you searched the UID, it’s sure that the data is there from it.

Well, this does not seem to me the result of a query, but a possible query itself. Dgraph does not return like that.

{“data”:{“myquery”: [{“userid”: 123456,
“user.login”: {
“~user.login”: {
“userid”: 123456
}
}
}]
},
“extensions”: {xxxxx}
}

Sorry, maybe this is more like it ?

The query doesn’t contain any uid predicate.

At first sight Taking your example into consideration, I would have this Mutation.

{
set {
  _:b0 <user.login> _:b1 .
  _:b0 <userid> "123456" .
  _:b1 <userid> "123456" .
 }
}

However, this mutation would create two Nodes.

For you to discover the UIDs of such Nodes. Would be.

{
myQuery(func: has(user.login)) {
   uid
 expand(_all_){ 
  uid
  expand(_all_)}
 }
}

The response would be:

{
  "data": {
    "myQuery": [
      {
        "uid": "0x2",
        "userid": "123456",
        "user.login": [
          {
            "uid": "0x3",
            "userid": "123456"
          }
        ]
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "processing_ns": 947200
    },
    "txn": {
      "start_ts": 27,
      "lin_read": {
        "ids": {
          "1": 10
        }
      }
    }
  }
}

But I feel like it’s not what you want. So I did

{
set {
   _:user1 <userid> "123456" .
   _:user1 <user.login> _:user1 . #Referencing to itself

 }
}

{
 myQuery(func: has(userid)) {
  uid
  userid
  user.login { 
  uid
  userid 
 ~user.login { 
  uid
  userid }
  }
 }
}

This result would be:

{
  "data": {
    "myQuery": [
      {
        "uid": "0x5",
        "userid": "123456",
        "user.login": [
          {
            "uid": "0x5",
            "userid": "123456",
            "~user.login": [
              {
                "uid": "0x5",
                "userid": "123456"
              }
            ]
          }
        ]
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "processing_ns": 1001900
    },
    "txn": {
      "start_ts": 42,
      "lin_read": {
        "ids": {
          "1": 13
        }
      }
    }
  }
}

About RDF visualizers:

Gephi is the powerful one that I wanted to remember https://gephi.org/
I played with him a little and liked what little I saw.

“Protégé” is another one. But a bit complex.

VisGraph VisGraph^3: a web tool for RDF visualization and creation

WebVOWL WebVOWL - Web-based Visualization of Ontologies

PoolParty Visual https://youtu.be/28HDqsDVnvk

https://code.google.com/archive/p/rdf-browser/

all about RDF standard SemanticWebTools - Semantic Web Standards

1 Like

I know I could add uid to predicate list in query. But I still can’t understand how ratel merges identical nodes

I don’t quite understand this line

i am confused about your question

Is it really necessary to know this? I can look for an exact answer in Ratel’s code. But I do not see why to do this, if you just want UID just add UID in the context of the query.

My guess is that Ratel forces the query with UID. There is no other way out than this.

Are you working with JavaScript? because Ratel is ReactJS.

Okay, I just need to make sure there are no other tricks which could circumvent querying uid.
Thank you.
I’m not familiar with js

uid is assigned itself by the ratel to the nodes depending on the relationship between nodes, As in example told by Michel, when a node is directly or indirectly referencing to itself, in that case no different uid will be assigned.
You can only get the uid’s associated with the node when you query for it along with the name or any information that you have added for the node…u can not add uid yourself it will be assigned by Ratel.
For example :
U load this data -

{
  set {
    _:michael <name> "Michael" .
    _:michael <age> "39" .
    _:michael <friend> _:amit .
    _:michael <friend> _:sarah .

    _:amit <name> "Amit" .
    _:amit <age> "35" .
    _:amit <friend> _:michael .

    _:sarah <name> "Sarah" .
    _:sarah <age> "55" .
  }
}

In order to get the uid for all these three, U have to make a query for uid -

{ everyone(func: anyofterms(name, "Michael")) {
    name age  uid
    friend {
      name age  uid
      friend {expand(_all_) uid  }
} } }

This will give the result containing all the fields loaded in database along with ths uid’s associated with it…
Result :

{
  "data": {
    "everyone": [
      {
        "name": "Michael",
        "age": 39,
        "uid": "0x5f06352",
        "friend": [
          {
            "name": "Amit",
            "age": 35,
            "uid": "0x5f06353",
            "friend": [
              {
                "name": "Michael",
                "age": 39,
                "uid": "0x5f06352"
              }
            ]
          },
          {
            "name": "Sarah",
            "age": 55,
            "uid": "0x5f06354"
          }
        ]
      }
    ]
  }

I hope it helps you clear your doubt.

1 Like