Can we import ttl data to memgraph

87 Views Asked by At

I am using neo4j graphDB to store the relationship but it seems neo4j is too heavy and consumes a lot of system memory as per my use case.While exploring multiple light weight graph database I came across memgraph which is light weight graphDB and has support for cypher but it seems it does not support for importing turtle dataset.

Is there any utility that can be use to import ttl data in memgraph? If not, Please suggest any light weight graphDB can be used which supports cypher and can be replaced with neo4j?

**As per the documentation only csv,json and CYPHERL data is supported for import in memgraph .

1

There are 1 best solutions below

0
Graph Dveler On

There is a tool called Rdf2Cypher. It hasn't been updated in a long time. I've used the following RDF:

@prefix ex: <http://example.org/#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

ex:John rdf:type foaf:Person ;
    foaf:name "John Doe" ;
    foaf:age 28 ;
    foaf:knows ex:Jane, ex:Bob .

ex:Jane rdf:type foaf:Person ;
    foaf:name "Jane Smith" ;
    foaf:age 25 ;
    foaf:knows ex:John, ex:Alice .

ex:Bob rdf:type foaf:Person ;
    foaf:name "Bob White" ;
    foaf:age 30 ;
    foaf:knows ex:Alice .

ex:Alice rdf:type foaf:Person ;
    foaf:name "Alice Green" ;
    foaf:age 29 ;
    foaf:knows ex:Jane, ex:Bob, ex:Eve .

ex:Eve rdf:type foaf:Person ;
    foaf:name "Eve Brown" ;
    foaf:age 27 ;
    foaf:knows ex:Alice .

and the output that I got is

CREATE (ex_Alice:foaf_Person {foaf_age:29, foaf_name:"Alice Green", _id:"ex_Alice", _uri:"http://example.org/#Alice" })
CREATE (ex_John:foaf_Person {foaf_age:28, foaf_name:"John Doe", _id:"ex_John", _uri:"http://example.org/#John" })
CREATE (ex_Eve:foaf_Person {foaf_age:27, foaf_name:"Eve Brown", _id:"ex_Eve", _uri:"http://example.org/#Eve" })
CREATE (foaf_Person {_id:"foaf_Person", _uri:"http://xmlns.com/foaf/0.1/Person" })
CREATE (ex_Bob:foaf_Person {foaf_age:30, foaf_name:"Bob White", _id:"ex_Bob", _uri:"http://example.org/#Bob" })
CREATE (ex_Jane:foaf_Person {foaf_age:25, foaf_name:"Jane Smith", _id:"ex_Jane", _uri:"http://example.org/#Jane" })
CREATE
(ex_Alice)-[:foaf_knows]->(ex_Eve),
(ex_Alice)-[:foaf_knows]->(ex_Bob),
(ex_Alice)-[:foaf_knows]->(ex_Jane),
(ex_Alice)-[:rdf_type]->(foaf_Person),
(ex_John)-[:foaf_knows]->(ex_Bob),
(ex_John)-[:foaf_knows]->(ex_Jane),
(ex_John)-[:rdf_type]->(foaf_Person),
(ex_Eve)-[:foaf_knows]->(ex_Alice),
(ex_Eve)-[:rdf_type]->(foaf_Person),
(ex_Bob)-[:foaf_knows]->(ex_Alice),
(ex_Bob)-[:rdf_type]->(foaf_Person),
(ex_Jane)-[:foaf_knows]->(ex_Alice),
(ex_Jane)-[:foaf_knows]->(ex_John),
(ex_Jane)-[:rdf_type]->(foaf_Person)

I've executed those queries in Memgraph Lab, and I got the following graph.

Memgraph Lab with graph as a result

Keep in mind that some cleanup could be required, e.g. this actually isn't a node.

CREATE (foaf_Person {_id:"foaf_Person", _uri:"http://xmlns.com/foaf/0.1/Person" })