Skip to content

Linked KItems are not refreshed after commiting  #30

@MBueschelberger

Description

@MBueschelberger

When I run the following code:

item1 = KItem(
    name="Machine-1",
    ktype_id=dsms.ktypes.TestingMachine,
    custom_properties={"Producer": "TestingLab GmBH",
                       "Room Number": "A404",
                       "Description": "Bending Test Machine"
                       }
)

item2 = KItem(
    name="Machine-2",
    ktype_id=dsms.ktypes.TestingMachine,
    custom_properties={"Producer": "StressStrain GmBH",
                       "Room Number": "B500",
                       "Description": "Compression Test Machine"
                       }
)

item3 = KItem(
    name="Specimen-1", 
    ktype_id=dsms.ktypes.Specimen,
    linked_kitems=[item1],
    annotations=["https://w3id.org/steel/ProcessOntology/TestPiece"],
    custom_properties={"Geometry": "Cylindrical 150mm x 20mm x 40mm",
                       "Material": "Concrete",
                       "Project ID": "ConstructionProject2024"
    }

)
item4 = KItem(
    name="Specimen-2",
    ktype_id=dsms.ktypes.Specimen,
    linked_kitems=[item2],
    annotations=["https://w3id.org/steel/ProcessOntology/TestPiece"],
    custom_properties={"Geometry": "Rectangular 200mm x 30mm x 20mm",
                       "Material": "Metal",
                       "Project ID": "MetalBlenders2024"
                       }
)

item5 = KItem(
    name="Research Institute ABC",
    ktype_id=dsms.ktypes.Organization,
    linked_kitems=[item1,item2],
    annotations=["www.researchBACiri.org/foo"],
)

dsms.commit()

When I want to print the linked kitems of item1, I get an empty list even if was passively linked by item3. This has the reason that item1 is the first item in the updated buffer. Therefore the refresh does not have the links to item3 etc. because they will be commited after item1.

A solution would be to make a set of the kitems running through the create- and updated-commit, which would be refreshed after the overall committing operation. Currently, items get refresh after each individual commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions