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

TTL_Adapter: List feature: categorise individuals as rdf:Seq instead of using rdf:Seq as object. #117

Closed DiellzaElshani closed 7 months ago

DiellzaElshani commented 1 year ago

Description:

Apparently the way we handle lists is wrong, because objects that have lists should be type rdf.Seq. In this case we could query elements of the sequence. Currently it appears that we created a new property name Seq, and rdf:_0,1,2 etc. are not related to the Seq.

Currently:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves rdf:Seq ;
        rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ;
        rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff> ;
        rdf:_2 <https://uni-stuttgart.de/68205cc2-5517-4ecb-21a0-40849eef35c2> ;
        rdf:_3 <https://uni-stuttgart.de/61819389-fb27-ffc5-4f31-966d86cf53f7>  .

This approach leads to the generation of properties named rdf:_0, rdf:_1, rdf:_2, and so on, which are not inherently associated with the rdf:Seq structure.

Afaik, the ideal structure should look like:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve, rdf:Seq; 

        rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ;
        rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff> ;
        rdf:_2 <https://uni-stuttgart.de/68205cc2-5517-4ecb-21a0-40849eef35c2> ;
        rdf:_3 <https://uni-stuttgart.de/61819389-fb27-ffc5-4f31-966d86cf53f7>  .

This proposed structure ensures that the sequence is associated with the correct type (rdf:Seq) and retains the proper order in querying, and also aligns better with the RDF specifications.

Consequently, TBox should be updated too. I need to think about the best way to represent it.

But the key part is that such Nodes are classified as rdf:Seq.

Steps to reproduce:

Expected behaviour:

Test file(s):

alelom commented 1 year ago

In the proposed structure, the name of the property (Curves) does not appear anywhere. This would make the deserialization impossible. For example, an alternative that would allow to deserialize is:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve.Curves, rdf:Seq; 

        rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ;
        rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff> ;
        rdf:_2 <https://uni-stuttgart.de/68205cc2-5517-4ecb-21a0-40849eef35c2> ;
        rdf:_3 <https://uni-stuttgart.de/61819389-fb27-ffc5-4f31-966d86cf53f7>  .

However, this is not correct from a T-box alternative, I think? @DiellzaElshani I think you need to clarify what the best option is (perhaps with @danielhz ) and then we can change the behaviour if we think it's useful. I would not categorize this a as a bug but as a feature, because the code behaves as previously agreed (it's not a malfunction of the code, but a modification in its working).

alelom commented 1 year ago

I now think that this issue may be based on a misunderstanding.

The BH.oM.Geometry.PolyCurve object is not a sequence itself; it's a class that has a property called Curves, and this latter is the sequence. Therefore, I don't think the change proposed in the issue should be done.

DiellzaElshani commented 1 year ago
image

I thought it should be something like this, but we can wait for Daniel to confirm.

DiellzaElshani commented 11 months ago

In our current approach, the objects of ordered collections are not linked to the Seq node. See our current approach: image

Discussing with @danielhz Daniel, here are two possible solutions:

Option 1) We can lose the property _:BH.oM.Geometry.PolyCurve.Curves_but save in our converter back, that anytime it deals with classes that are Ordered collections it retrieves this property automatically somehow.

image

Option 2) We create e new node that is type of RDF seq, as suggestion per my pervious comment: image

In TTL this is how it would look like the following:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve ; rdf:Seq. 
        :BH.oM.Geometry.PolyCurve.Curves :newNode1. 

        :newNode1   rdf:type rdf:Seq;
        :newNode1   rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ,
        :newNode1   rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>.

        <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>  rdf:type   :BH.oM.Geometry.Line.

This wouldn't require us to change anything in the TBox representation:

image

DiellzaElshani commented 11 months ago

@danielhz what do you think about this solution?

we dont use blank node, because in that case, we dont know which sequence belongs to which objects. So we thought using a new individual, just duplicating the URI ID of the main class that contains the seq, and we add "seq" in the end. This means that the URI of this sequence will be unique anytime we use it.

Here is a snippet:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve. 
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq>. 

        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq>   rdf:type rdf:Seq;
        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq>   rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>,
        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq>   rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>.

        <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>  rdf:type   :BH.oM.Geometry.Line.
        <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>  rdf:type   :BH.oM.Geometry.Line.

A problem that I see with this approach is that in future if we want to publish this data on the web I see a problem with the URI.

DiellzaElshani commented 11 months ago

Or @alelom can you think of ways to deserialize if we follow this format:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve, rdf:Seq; 

        rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ;
        rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff> ;
        rdf:_2 <https://uni-stuttgart.de/68205cc2-5517-4ecb-21a0-40849eef35c2> ;
        rdf:_3 <https://uni-stuttgart.de/61819389-fb27-ffc5-4f31-966d86cf53f7>  .
DiellzaElshani commented 10 months ago

After our meeting with Daniel and Alessio, the current solution to lists in individuals part is as following:


### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve. 
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b/seq>. 

        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b/seq>   rdf:type rdf:Seq;
        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b/seq>   rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>,
        <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b/seq>   rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>.

        <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>  rdf:type   :BH.oM.Geometry.Line.
        <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>  rdf:type   :BH.oM.Geometry.Line.
alelom commented 9 months ago

Solution agreed:

Instead of:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,
        :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves rdf:Seq ;
        rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508> ;
        rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff> ;
        rdf:_2 <https://uni-stuttgart.de/68205cc2-5517-4ecb-21a0-40849eef35c2> ;
        rdf:_3 <https://uni-stuttgart.de/61819389-fb27-ffc5-4f31-966d86cf53f7>  .

Do this:

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95b> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve;
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq>.

### https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq
<https://uni-stuttgart.de/c96b157f-e8a7-26fc-af6a-d8409a8cf95bseq> rdf:type owl:NamedIndividual,    :rdf:Seq;
                                                                            rdf:_0 <https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>;
                                                                            rdf:_1 <https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>.

### https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508
<https://uni-stuttgart.de/09e133ce-2e99-ae92-45fb-1d0477f80508>  rdf:type owl:NamedIndividual,  :BH.oM.Geometry.Line;
                        ... geometry X, Y, Z...

### https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff
<https://uni-stuttgart.de/e0bb1765-74da-6acc-1f59-452e29f5a7ff>  rdf:type owl:NamedIndividual,  :BH.oM.Geometry.Line;
                        ... geometry X, Y, Z...
polnischfrosch commented 7 months ago

Output from most recent commit looks like this:

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq>. 

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq>. rdf:type owl:NamedIndividual,   :rdf:Seq;
            rdf:_0 <https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> ;
            rdf:_1 <https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> ;

### https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce
<https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line;

### https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2
<https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line .

How do you imagine the format of "... geometry X, Y , Z..." to look like? Should this be the entire individual again like so?

### https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2
<https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.Line ;
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> ;
        :BH.oM.Geometry.Line.Infinite "False"^^xsd:boolean .

### https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270
<https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.Point ;
        :BH.oM.Geometry.Point.X "3"^^xsd:double;
        :BH.oM.Geometry.Point.Y "1"^^xsd:double;
        :BH.oM.Geometry.Point.Z "0"^^xsd:double .

Or only the geometry part like this?

        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> ;
        :BH.oM.Geometry.Line.Infinite "False"^^xsd:boolean .
        :BH.oM.Geometry.Point.X "3"^^xsd:double;
        :BH.oM.Geometry.Point.Y "1"^^xsd:double;
        :BH.oM.Geometry.Point.Z "0"^^xsd:double .

Or completely different to all of the above

polnischfrosch commented 7 months ago

Comments for changes from call on 10.01.2024:

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq>. 

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq> rdf:type owl:NamedIndividual,    :rdf:Seq;
            rdf:_0 <https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> ;
            rdf:_1 <https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> ;

### https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce
<https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line.
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> ;

### https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2
<https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line .
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> ;
DiellzaElshani commented 7 months ago
### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq>. 

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq> rdf:type owl:NamedIndividual,    :rdf:Seq;
            rdf:_0 <https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> ;
            rdf:_1 <https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2>.

### https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce
<https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line;
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> .

### https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2
<https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line;
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> .
polnischfrosch commented 7 months ago

Output from most recent commit:

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17> rdf:type owl:NamedIndividual ,  :BH.oM.Geometry.PolyCurve ;
        :BH.oM.Geometry.PolyCurve.Curves <https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq>. 

### https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq
<https://uni-stuttgart.de/f0978af5-3fd0-6e04-d055-f32d0ea51d17seq> rdf:type owl:NamedIndividual,    :rdf:Seq;
            rdf:_0 <https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> ;
            rdf:_1 <https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> .

### https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce
<https://uni-stuttgart.de/0241fa0c-da61-3c70-048f-89fd4e4492ce> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line;
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/2564f8d7-183a-f629-052c-2f92cfe1fd83> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.Infinite "False"^^xsd:boolean.

### https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2
<https://uni-stuttgart.de/253fa989-1432-cd78-104c-cebdd348a7c2> rdf:type owl:NamedIndividual,   BH.oM.Geometry.Line;
        :BH.oM.Geometry.Line.Start <https://uni-stuttgart.de/6fddb0f7-ba48-87f7-ff91-45bb1dde7697> ;
        :BH.oM.Geometry.Line.End <https://uni-stuttgart.de/15f1e9e1-a449-2be2-7cce-be3cd3fbe270> ;
        :BH.oM.Geometry.Line.Infinite "False"^^xsd:boolean.