GfSE / SpecIF-Schema

Definition of the SpecIF JSON-schema and constraint checker
Apache License 2.0
1 stars 0 forks source link

Complex Data Types #22

Open odungern opened 7 months ago

odungern commented 7 months ago

So far, SpecIF is limited to a simple data type per propertyClass. resourceClasses and statementClasses can have a flat list of propertyClasses with a simple dataType, each.

Very probably we will need complex data types such as 3D coordinates.

odungern commented 7 months ago

Proposal:

This is about the typing ... still some thoughts are needed how to represent the instances.

odungern commented 7 months ago

Now a proposal for the values of complex data types:

An example will follow.

Comments and other proposals are welcome!

odungern commented 7 months ago

First part of an example, namely a complex dataType:

  {
    "id": "DT-CoordinateX",
    "title": "A X-coordinate as a real number.",
    "type": "xs:double",
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  }, {
    "id": "DT-CoordinateY",
    "title": "A Y-coordinate as a real number.",
    "type": "xs:double",
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  }, {
    "id": "DT-CoordinateZ",
    "title": "A Z-coordinate as a real number.",
    "type": "xs:double",
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  },{
    "id": "DT-GeoPoint",
    "title": "geo:Point",
    "type": "xs:complex",
    "description": [{
    "text": "A point in space, specified by three coordinates.",
    "language":"en"
    },{
    "text": "Ein Punkt im Raum, spezifiziert durch drei Koordinaten.",
    "language":"de"
    }],
    "dataTypes": [{
    "id": "DT-CoordinateX"
    },{
    "id": "DT-CoordinateY"
    },{
    "id": "DT-CoordinateZ"
    }],
    "multiple": false,
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  }

... and the referencing propertyType:

  {
    "id": "PC-GeoPoint",
    "title": "geo:Point",
    "description": [{
        "text":"A point in space, specified by three coordinates.",
        "language":"en"
    },{
        "text":"Ein Punkt im Raum, spezifiziert durch drei Koordinaten.",
        "language":"de"
    }],
    "dataType: { "id": "DT-GeoPoint" },
    "multiple": false,
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  }
odungern commented 3 months ago

Another option is to construct is to assemble a complex data type as propertyClass. The dataTypes remain scalar (simple), then.

  {
    "id": "DT-Coordinate",
    "title": "A spacial coordinate as a real number.",
    "type": "xs:double",
    "revision": "1.2",
    "changedAt": "2024-25T09:08:31.960Z"
  },{
    "id": "DT-GeoPoint",
    "title": "geo:Point",
    "type": "xs:complex",
    "description": [{
    "text":"A point in space, specified by three coordinates.",
    "language":"en"
    },{
    "text":"Ein Punkt im Raum, spezifiziert durch drei Koordinaten.",
    "language":"de"
    }],
    "multiple": false,
    "revision": "1.2",
    "changedAt": "2023-11-14T19:08:31.960Z"
  }

... and the referencing propertyTypes:

  {
    "id": "DT-CoordinateX",
    "title": "A X-coordinate as a real number.",
    "dataType": {
        "id": "DT-Coordinate"
    },
    "revision": "1.2",
    "changedAt": "2024-25T09:08:31.960Z"
  }, {
    "id": "PC-CoordinateY",
    "title": "A Y-coordinate as a real number.",
    "dataType": {
        "id": "DT-Coordinate"
    },
    "revision": "1.2",
    "changedAt": "2024-25T09:08:31.960Z"
  }, {
    "id": "PC-CoordinateZ",
    "title": "A Z-coordinate as a real number.",
    "dataType": {
        "id": "DT-Coordinate"
    },
    "revision": "1.2",
    "changedAt": "2024-25T09:08:31.960Z"
  }, {
    "id": "PC-GeoPoint",
    "title": "geo:Point",
    "description": [{
        "text": "A point in space, specified by three coordinates.",
        "language":"en"
    },{
        "text": "Ein Punkt im Raum, spezifiziert durch drei Koordinaten.",
        "language":"de"
    }],
    "dataType: { "id": "DT-GeoPoint" },
    "propertyClasses": [{
        "id": "PC-CoordinateX"
    },{
        "id": "PC-CoordinateY"
    },{
        "id": "PC-CoordinateZ"
    }],
    "multiple": false,
    "revision": "1.2",
    "changedAt": "2024-25T09:08:31.960Z"
  }

Let's discuss the consequences for definining such a complex dataType/propertyClass in an ontology. Some complex dataTypes such as the Geo-Point can certainly be treated as an axiom such as xs:integer, but certainly not all. With all likelihood we will need to define complex dataTypes as part of a domain language.