Advanced: Extending an additional model

DCH's model generation tooling features the ability to provide existing model(s) as inputs and to extend those models. Note the tool has no capability to remove things from provided models, only to update them via the operations and information in the input CSVs.

To do this the provided zip file needs to contain a folder called input_ttls. Any existing turtle files that you want to update need to be place in that folder with the file extension ".ttl". Other than the .ttl extension the file names are not important; all files in the folder will be available to be updated. Care must be taken to match URI's in provided turtle files with the manifest and model_id used in the csv's. There is one further combination of manifest id_mapping, turtle file URIs and prefixes and csv model_id's not covered in the URI discussion above:

Example 5: Turtle file URIs matching manifest without prefixes matching model_id's


Inputs

manifest.json
{
  "manifest_version": "1.0.0",
  "id_mapping": {
    "mySiteModel": "dch:org/documentation/site/Usage_Eg5_Tasmanian_Maritime_Museum#",
    "myBuildingModel": "dch:org/documentation/site/Usage_Eg5_Tasmanian_Maritime_Museum/building/museum_eg5#"
  },
  "operations": [
    {
      "operation_type": "CREATE",
      "config": {
        "object_file": "objects.csv"
      }
    }
  ]
}
objects.csv
Model_ID|Entity_Name,Class
mySiteModel|siteName,Site
myBuildingModel|buildingName,Building

Also providing the following input turtle files in the input_ttls folder in the provided zip file:

input_ttls/model_site.ttl
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix SITE: <dch:org/demo/site/Usage_Eg5_Tasmanian_Maritime_Museum#> .

SITE:siteName a brick:Site .
input_ttls/model_building.ttl
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix BUILDING: <dch:org/demo/site/Usage_Eg5_Tasmanian_Maritime_Museum/building/museum#> .

BUILDING:buildingName a brick:Building .

The key thing to note with this set of inputs is that the prefix in the provided model_site.ttl, "SITE" is different to the model_id used within objects.csv, "mySiteModel". Similarly, model_building.ttl defines the prefix as "BUILDING", while objects.csv sets the model_id as myBuildingModel. However, the URIs defined within the id_mapping field of manifest.json match the model_ids defined within objects.csv. In this situation the tool correctly identifies and maps the URIs irrespective of the different turtle file prefix.

Example 5: Full input archive

Outputs

Zipping up the Manifest, the input_csvs folder and the input_ttls folder and running the script will produce the following two output files. No warnings are generated in the Log.

mySiteModel.ttl
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix mySiteModel: <dch:org/documentation/site/Usage_Eg5_Tasmanian_Maritime_Museum#> .

mySiteModel:siteName a brick:Site ;
    brick:keyValue [ brick:key "mgtool" ;
            brick:value "build date: 2024-04-08" ],
        [ brick:key "mgtool" ;
            brick:value "version: 2.0" ] .
myBuildingModel.ttl
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix myBuildingModel: <dch:org/documentation/site/Usage_Eg5_Tasmanian_Maritime_Museum/building/museum_eg5#> .

myBuildingModel:buildingName a brick:Building ;
    brick:keyValue [ brick:key "mgtool" ;
            brick:value "version: 2.0" ],
        [ brick:key "mgtool" ;
            brick:value "build date: 2024-04-08" ] .

The full output archive can be found below:

Example 5: Full output archive

Last updated