What rdf files? how can i create it

is this rdf files?
_:alice _:bob .
_:alice _:carol .
_:alice .

_:bob _:carol .

_:carol _:bob .
_:carol .

_:erin _:bob .
_:erin _:carol .

_:frank _:carol .
_:frank .
_:frank _:erin .

_:grace _:alice .
_:grace _:bob .
_:grace _:carol .
_:grace .
_:grace _:erin .
_:grace _:frank .

_:alice “Alice” .
_:bob “Bob” .
_:carol “Carol” .
_:erin “Erin” .
_:frank “Frank” .
_:grace “Grace” .

or this ?

<?xml version="1.0"?> <?xml-stylesheet type="text/xsl"?>

<rdf:RDF xml:lang=“en”
xmlns:foaf=“FOAF Vocabulary Specification”>

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ...... how you create it from mysql data?

why rdf files of dgraph is not similar to others?

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

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:


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

thank you very much ! I have create RDF file with python ,But there is still some question i meet ,hope you can see my questions today

There is a tool may helps. http://d2rq.org/
d2rq mapping ~

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.