neo4j-labs / rdflib-neo4j

RDFLib Store backed by neo4j + n10s
Apache License 2.0
55 stars 6 forks source link

Are we able to add attribute for predicate in RDFlib, and save it to neo4j as relationship's attribute #20

Open JasonPad19 opened 6 months ago

JasonPad19 commented 6 months ago

Hi

Thanks for supporting the rdf-neo4j integration.

I am facing a challenge that we need to maintain a history of data in neo4j. The easiest practice in neo4j is to add a date attribute under the relationship between node A and node B. Yet, the source data we are importing are from turtle files. I haven't figured out an efficient way to push multiple date's turtle files into neo4j, and maintaining the date attribute at the same time.

source turtle files 2024-01-01Order.ttl Customer A -> buys -> Product A

2024-01-02Order.ttl Customer B -> buys -> Product A

expected view in neo4j Customer A -> buys ( order date: 2024-01-01) -> Product A Customer B -> buys ( order date: 2024-01-02)-> Product A

Would you suggest any practice please?

alfredorubin96 commented 5 months ago

Can you please give us more information about your use case? The Turtle file format doesn't support properties on relationships, and currently rdflib doesn't support the parse of the rdf star format, that is the one that supports this kind of data.

JasonPad19 commented 5 months ago

Thanks for your comments. :)

Yes, We will have daily facts that will be converted to triples via rdflib, and then pushed to neo4j using rdflib-neo4j package. e.g.

And, we would like to keep the history in neo4j as well, which will end up a rdf-star format or attribute on predicate.

But I am not sure what is the best approach to construct the presentation in neo4j based on our daily ttl files, considering using rdflib-neo4j package.

alfredorubin96 commented 1 month ago

First of all, sorry for the late answer, in second place: the possibility of adding relationship properties on the nodes is something that we currently don't offer, due to the fact that that rdflib doesn't officially support rdf-star.

We are thinking about a way to skip this problem, but it requires some time.

Let us know if you need anything else