BHoM / RDF_Prototypes

Research project of the Cluster of Excellence "Integrative Computational Design and Construction for Architecture" (IntCDC) https://www.intcdc.uni-stuttgart.de/ **Project Name**: Knowledge Representation for Multi-Disciplinary Co-Design of Buildings. https://www.intcdc.uni-stuttgart.de/research/research-projects/rp-20/
GNU Lesser General Public License v3.0
9 stars 4 forks source link

Is data trees representation in RDF possible? #46

Open DiellzaElshani opened 2 years ago

DiellzaElshani commented 2 years ago

Description:

BHoM allows data tree as input in custom objects, however we did not provide a translation of data trees in RDF. Currently they are translated to Base64JsonSerialized. Is there any way to represent data trees in RDF @danielhz ?

DiellzaElshani commented 2 years ago

ps: to add, a data tree is a graph basically, we just need to explode the information within it.

danielhz commented 2 years ago

Have these threes labelled edges? Does this tree have a defined root? Are siblings ordered? As is suggested, a tree is a graph without cycles. Thus, modeling a tree with a graph is straightforward. However, some trees can be modeled in special ways.

alelom commented 2 years ago

@danielhz

Have these threes labelled edges?

Yes, with an identifier in the form of {branch; sub-branch; sub-sub-branch; ... }: image image

Does this tree have a defined root?

Not sure what do you mean by defined root, but yes, the label {0} will always have the source corresponding to the root.

Are siblings ordered?

Yes, see images above.

danielhz commented 2 years ago

These trees can be represented with collections or with containers. The following are two ways to represent the two trees in the first figure.

With rdf:Seq

:tree1 a bhom:Tree ;
  bhom:treeValues [ a rdf:Seq ; rdf:_1 :u1 ; rdf:_2 :u2; rdf:_3 :u3 ; rdf:_4 :u4 ] .

:tree a bhom:Tree ;
  bhom:treeValues [ rdf:Seq ;
    rdf:_1 [ a rdf:Seq ; rdf:_1 :u1 ; rdf:_2 :u2 ] ;
    rdf:_2 [ a rdf:Seq ; rdf:_1 :u3 ; rdf:_2 :u4 ] ] .

With rdf:Collection

:tree1 a bhom:Tree ;
  bhom:treeValues ( :u1 :u2 :u3 :u4 ) .

:tree a bhom:Tree ;
  bhom:threeValues ( ( :u1 :u2 )  ( :u3 :u4 ) ) .