Re: Translating Property Graphs with Multiple Labels to RDF-sta

Yes, Niklas shows a possibility:

   :e1 :amount 1000 ;
       :currency "gbp" ;
       :date "2002-09-24Z" ;
       rdf:reifies <<( :a1 :TRANSACTION :a2 )>> ,
                   <<( :a1 :FinancialOperation :a2 )>> .

   :e2 :amount 500 ;
       :currency "eur" ;
       :date "2003-10-24Z" ;
       rdf:reifies <<( :a1 :TRANSACTION :a2 )>> ,
               <<( :a1 :FinancialOperation :a2 )>> .

   :e3 :amount  900 ;
       :currency "gbp" ;
       :date "2002-10-03Z" ;
       rdf:reifies <<( :a2 :TRANSACTION :a3 )>> ,
               <<( :a2 :FinancialOperation :a3 )>> .

Which could be written in Turtle:


<< :e1 | :a1 :TRANSACTION :a2 >> a :transaction .
<< :e1 | :a1 :FinancialOperation :a2 >> a : financialOperation .


<< :e2 | :a1 :TRANSACTION :a2 >> a :transaction .
<< :e2 | :a1 :FinancialOperation :a2 >> a : financialOperation .


<< :e3 | :a2 :TRANSACTION :a3 >> a :transaction .
<< :e3 | :a2 :FinancialOperation :a3 >> a : financialOperation .


:e1 :amount 1000 ;

    :currency "gbp" ;
    :date "2002-09-24Z"^^xsd:date .

:e2 :amount 500 ;
    :currency "eur" ;
    :date "2003-10-24Z"^^xsd:date .

:e3 :amount 900 ;
    :currency "gbp" ;
    :date "2002-10-03Z"^^xsd:date .

The world is your oyster :-)
cheers
—e.

On Tue, Jul 23, 2024 at 1:09 PM ddooss@wp.pl <ddooss@wp.pl> wrote:

Hi Enrico,

Dnia 23 lipca 2024 12:54 Franconi Enrico <franconi@inf.unibz.it> napisał(a):

Hi Dominik,

As you know, many definitions of Property Graphs, including those utilized in GQL, permit nodes and edges to possess multiple labels. This is somewhat different from the examples commonly cited, such as those on the wiki, which typically feature nodes and edges with single labels for simplicity and clarity.

To illustrate my point, consider the following Property Graph example where both nodes and edges have dual labels:

CREATE (a1:Account:FinancialEntity {accountNumber: 1})
CREATE (a2:Account:FinancialEntity {accountNumber: 2})
CREATE (a3:Account:FinancialEntity {accountNumber: 3})

CREATE (a1)-[:TRANSACTION:FinancialOperation {amount: 1000, currency: "gbp", date: "2002-09-24Z"}]->(a2)
CREATE (a1)-[:TRANSACTION:FinancialOperation {amount: 500, currency: "eur", date: "2003-10-24Z"}]->(a2)
CREATE (a2)-[:TRANSACTION:FinancialOperation {amount: 900, currency: "gbp", date: "2002-10-03Z"}]->(a3)

In this scenario, nodes are labeled both as `Account` and `FinancialEntity`, and edges are labeled as `TRANSACTION` and `FinancialOperation`. This dual labeling adds a layer of complexity when attempting to translate such Property Graphs to RDF-star.

Multiple labels on nodes: the following triples should be added to the example in the wiki:

:a1 a :Account , :FinancialEntity .

:a2 a :Account , :FinancialEntity .
:a3 a :Account , :FinancialEntity .


Yes, that was expected.

Multiple labels on relationships:
Cypher does not allow for multiple labels (type) on relationships, while you could easily have them using the reified relationship with the proposed mappings in RDF-star:

:e1 a :transaction , :FinancialOperation .

:e2 a :transaction , :FinancialOperation .

:e3 a :transaction , :FinancialOperation .


Yes, Neo4j does not support multiple labels. But I used that syntax to simplicity.
So how the full example will look like? How this part will be write in the new syntax:
<< :e1 | :a1 :TRANSACTION :a2 >>
 :amount 1000 ;
 :currency "gbp" ;
 :date "2002-09-24Z"^^xsd:date .

Best,
Dominik

Received on Tuesday, 23 July 2024 11:31:56 UTC