How to set Labels in Ratel UI

I have loaded JSON data in ratel and then I have run a query which only displays nodes. So, how to set label to each node?

That depends on what kind of label you’re talking about.

  "set": [
     {
       "uid": "0xd", #UID of the existing node.
       "label": ""
     }
  ]
}
  "set": [
     {
       "uid": "0xd", #UID of the existing node.
       "labelx": "true"
     }
  ]
}
  "set": [
     {
       "uid": "0xd", #UID of the existing node.
       "type": "message"
     }
  ]
}

I have loaded my dataset [in JSON format] by using bulk loader which contains 98k triples in the format,
{

"Subject": "MeasureData_Precipitation_4UT01_2004_8_8_19_30_00>",

"Predicate": "sensor-observation.owl#uom>",

"Object": "weather.owl#centimeters>"

},

{

"Subject": "Observation_WindDirection_4UT01_2004_8_8_9_35_00>",

"Predicate": "22-rdf-syntax-ns#type>",

"Object": "weather.owl#WindDirectionObservation>"

},

{

"Subject": "Observation_WindDirection_4UT01_2004_8_8_9_35_00>",

"Predicate": "sensor-observation.owl#observedProperty>",

"Object": "weather.owl#_WindDirection"

}

and so on…
So when I run a query after loading data by bulk loader it shows output

As we can see here there is no label; here I want to label each node by its subject name.
Also I want to create edges between subject and object…will it be possible?

Wait, is this a JSON representation of a RDF? This format is invalid for Dgraph. Works, but invalid.

This is because the format is wrong. Check the right format in docs.

I have converted my .csv file by using csv2json command as per given in docs.

$csv2json csvfile --out jsonfilename

I did this image to explaing a bit the JSON format.

hummm, I have to check this. Seems wrong.

Nope, the Docs are right. :confused:

But I have followed the steps given in docs.

This is how my csv looks like.

Okay, your CSV is a JSON representation of RDF format.

Like this:

You need to convert this. Or export to RDF. It’s already in RDF tho. But in a CSV file.

Can you suggest me how?
I didn’t find any such tool for direct conversion.
And after converting it to RDF …again I have to convert it to JSON right?

Try Export to a text file and if you have something like this:
<observation ...> <22-rdf-syntax...> <weatger...>
you’re good to go. So you just need to add a “.” dot in every Nquads lines and use it in a mutation.

BTW, I recomend that you clean a bit this file. Maybe it will not be a problem, but if it gives you’ll have to clean it up a bit. Like Objects need to be in quotes “obj”. And some RDF types can be not supported. But just test it first. see the types Get started with Dgraph

Don’t need. Use the RDF.

No., I don’t have all strings like this. And I have 98k triples. So, to set it like that is a crucial task I guess.:roll_eyes::roll_eyes:

Didn’t get it. You can.

I think you didn’t undestood what I said.

So, I did this: Exported to “.tsv”:

And you just need to do this:

And you’re good to go.

Ooh Okay…okay
Got it!
Then by which extension should I save it?.. I mean will it be .rdf file?
Because in bulk loader I have to pass .rdf file…so…

Don’t need. You gonna use Ratel right? can be text. If you gonna use Liveload or Bulk, can be any format tho. But if so, use *.rdf

okay
Then label will create automatically…right?

Sorry, I still do not understand which Label you’re talking about. The “kind” or the naming representation in Ratel UI?

This snapshot is the result of data given in docs[tour.dgraph.io]

Here each node and edge contains a label for ex. nodes have names like Michael, Amit etc.[with green and blue font …just below the nodes],edge is containing f on it.

So I want that type of label on my nodes I mean by using my dataset.

Ah, okay. This is “the naming representation in Ratel UI”. So this takes in consideration the predicate itself. I’m not sure what pattern it chooses to predict Ratel “labeling”, but it will certainly recognize one. If not, try using Alias.
e.g:

{
   q(func: ...){
     somepred
     name : someother_pred
   }
}

So using “name”, maybe Ratel will capture the values of “someotether_pred” as default.