What rdf files? how can i create it

No, but is RDF.

RDF files use “mydata.rdf” The format is pretty simple:

<_:uid3> <friend> _:uid4 .
<_:uid4> <username> "Michael Jackson" .

Subject => Predicate => Object => (Facets if needed)

PS. This above, is only a example.

It’s similar, just do not use the same standard.

From SQL I do not know, but if you are able to export correctly to JSON or even JSON-LD you can do this which I will describe below:

Save this with your life xD JSON-LD Playground

Here a JSON-LD example:

[{
  "@context": "http://schema.org/",

  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
},
{
  "@context": "http://schema.org/",

  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
},
{
  "@context": "http://schema.org/",

  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}]

If you want do relations, you must add a JSON object inside the JSON
object.

If you add this JSON in the field and use the N-Quads tab you will have a similar result to this below

_:b0 <http://schema.org/jobTitle> "Professor" .
_:b0 <http://schema.org/name> "Jane Doe" .
_:b0 <http://schema.org/telephone> "(425) 123-4567" .
_:b0 <http://schema.org/url> <http://www.janedoe.com> .
_:b1 <http://schema.org/jobTitle> "Professor" .
_:b1 <http://schema.org/name> "Jane Doe" .
_:b1 <http://schema.org/telephone> "(425) 123-4567" .
_:b1 <http://schema.org/url> <http://www.janedoe.com> .
_:b2 <http://schema.org/jobTitle> "Professor" .
_:b2 <http://schema.org/name> "Jane Doe" .
_:b2 <http://schema.org/telephone> "(425) 123-4567" .
_:b2 <http://schema.org/url> <http://www.janedoe.com> .

That would be the RDF N-quads result, your job now would be to clear “http://schema.org/” from the predicate fields. And change the predicate URL to string (“http://www.janedoe.com”)

You can use Visual Studio Code. Using “Command + F” and using the Replacement option. Hence you have to replace the fields with “http://schema.org/” with “nothing” so you will only have only the predicates. And the fields with http://www.janedoe.com you have to replace with quote marks: “http://www.janedoe.com”.

The result treated would look like this:

Ready to be used in Dgraph mutation

{
   Set {
    _:b0 <jobTitle> "Professor" .
    _:b0 <name> "Jane Doe" .
    _:b0 <elephone> "(425) 123-4567" .
    _:b0 <url> "http://www.janedoe.com" .
    _:b1 <jobTitle> "Professor" .
    _:b1 <name> "Jane Doe" .
    _:b1 <telephone> "(425) 123-4567" .
    _:b1 <url> "http://www.janedoe.com" .
    _:b2 <obTitle> "Professor" .
    _:b2 <name> "Jane Doe" .
    _:b2 <telephone> "(425) 123-4567" .
    _:b2 <url> "http://www.janedoe.com" .
    }
}

We’ll soon have something like this, but Ratel this week will support standard JSON. So there is no hurry. :upside_down_face:

Note:

The json-ld.org playground It does not generate an RDF file or a fully compatible RDF, you need to “handle” the Playground result as I mentioned above.

1 Like