3lbits / CIM4NoUtility

CIM for the Norwegian Power Utility
Creative Commons Attribution Share Alike 4.0 International
20 stars 7 forks source link

JSON-LD: use shortened props and lowerCamelCase #331

Open VladimirAlexiev opened 6 months ago

VladimirAlexiev commented 6 months ago

@Sveino

As clarified during a previous session, the concerns in https://github.com/VladimirAlexiev/soml/blob/master/owl2soml/CIM-shorten.md are not a problem:

By using JSON-LD 1.1 (#330) "local contexts" it is possible to have short prop names in the payload.

    {
      "@id": "urn:uuid:9d58e5bb-834c-4faa-928c-7da0bb1497d9",
      "@type": "ACLineSegment",
      "mRID": "9d58e5bb-834c-4faa-928c-7da0bb1497d9",
      "description": "400V Telemarkstien 2 ACLineSegment 1",
      "name": "04 TELEMA2 ACLS1",
      "aggregate": false,
      "normallyInService": true,
      "length": "50.0",
      "bch": "0.0",
      "gch": "0.0",
      "r": "0.015999999945951",
      "x": "0.003769911221053",
      "assetDatasheet": "urn:uuid:d25f35ca-69fb-4c06-905b-67ec532e5f14" ,
      "equipmentContainer": "urn:uuid:64e21d95-8b55-b941-a923-b74087410a66" ,
      "baseVoltage": "urn:uuid:9598e4a0-67e5-4ad7-879c-c85a1f63159c"
    },
    {
      "@id": "urn:uuid:3d51330c-7528-4efb-8edc-e61dcc145ac4",
      "@type": "Bay",
      "mRID": "3d51330c-7528-4efb-8edc-e61dcc145ac4",
      "description": "Nedenes 400V Low Voltage Cable 1 Bay",
      "name": "NEDENES  04LC1",
      "voltageLevel": "urn:uuid:681a21b6-5a55-11eb-a658-74e5f963e191"
    },
    {
      "@id": "urn:uuid:681a21b6-5a55-11eb-a658-74e5f963e191",
      "@type": "VoltageLevel",
      "mRID": "681a21b6-5a55-11eb-a658-74e5f963e191",
      "description": "Secondary Substation LV",
      "name": "NEDENES 04",
      "baseVoltage": "urn:uuid:9598e4a0-67e5-4ad7-879c-c85a1f63159c",
      "substation": "urn:uuid:681a2179-5a55-11eb-a658-74e5f963e191"
    }
VladimirAlexiev commented 6 months ago

The gist https://gist.github.com/VladimirAlexiev/d691a9c66c348877d6c90420b52dec40 file DIGIN10-30-LV1_EQ-shortProps.jsonld shows how this can be done:

  "@context": {
    "@vocab":  "http://ucaiug.org/ns/CIM#",
    "cim":     "http://ucaiug.org/ns/CIM#",
    "rdf":     "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "eu":      "http://iec.ch/TC57/CIM100-European#",
    "dct":     "http://purl.org/dc/terms/",
    "dcat":    "http://www.w3.org/ns/dcat#",
    "prov":    "http://www.w3.org/ns/prov#",
    "xsd":     "http://www.w3.org/2001/XMLSchema#",
    "dcat:isVersionOf":      {"@type": "@id"},
    "dct:conformsTo":        {"@type": "@id"},
    "dct:issued":            {"@type": "xsd:dateTime"},
    "dct:references":        {"@type": "@id"},
    "dct:spatial":           {"@type": "@id"},
    "dct:temporal":          {"@type": "@id"},
    "prov:generatedAtTime":  {"@type": "xsd:dateTime"},
    "mRID":                  {"@id": "IdentifiedObject.mRID"},
    "Bay":                   {"@context": {"description":        {"@id": "IdentifiedObject.description"},
                                           "name":               {"@id": "IdentifiedObject.name"},
                                           "voltageLevel":       {"@id": "Bay.VoltageLevel","@type":  "@id"}}},
    "ConductingEquipment":   {"@context": {"baseVoltage":        {"@id": "ConductingEquipment.BaseVoltage","@type": "@id"}}},
    "Equipment":             {"@context": {"equipmentContainer": {"@id": "Equipment.EquipmentContainer","@type": "@id"}}},
    "PowerSystemResource":   {"@context": {"assetDatasheet":     {"@id": "PowerSystemResource.AssetDatasheet", "@type": "@id"}}},
    "VoltageLevel":          {"@context": {"description":        {"@id": "IdentifiedObject.description"},
                                           "name":               {"@id": "IdentifiedObject.name"},
                                           "substation":         {"@id": "VoltageLevel.Substation", "@type": "@id"},
                                           "baseVoltage":        {"@id": "VoltageLevel.BaseVoltage", "@type": "@id"}}},
    "Conductor":             {"@context": {"length":             {"@id": "Conductor.length", "@type": "xsd:float"}}},
    "ACLineSegment":         {"@context": {"description":        {"@id": "IdentifiedObject.description"},
                                           "name":               {"@id": "IdentifiedObject.name"},
                                           "aggregate":          {"@id": "Equipment.aggregate", "@type":"xsd:boolean"},
                                           "normallyInService":  {"@id": "Equipment.normallyInService", "@type":"xsd:boolean"},
                                           "length":             {"@id": "Conductor.length", "@type":"xsd:float"},
                                           "assetDatasheet":     {"@id": "PowerSystemResource.AssetDatasheet", "@type":"@id"},
                                           "equipmentContainer": {"@id": "Equipment.EquipmentContainer", "@type":"@id"},
                                           "baseVoltage":        {"@id": "ConductingEquipment.BaseVoltage", "@type":"@id"},
                                           "bch":                {"@id": "ACLineSegment.bch", "@type": "xsd:float"},
                                           "gch":                {"@id": "ACLineSegment.gch", "@type": "xsd:float"},
                                           "r":                  {"@id": "ACLineSegment.r", "@type": "xsd:float"},
                                           "x":                  {"@id": "ACLineSegment.x", "@type": "xsd:float"}}}
  }
Sveino commented 5 months ago

@VladimirAlexiev You wrote "Therefore, we can use the short name P in JSON to make instance data as pleasant as possible for developers." - find two developer with the same preference is like finding to identical snowflakes... This is the right time to have this discussion. I am in general a fan of getting it shorten. However, there are some semantic challenges.

VladimirAlexiev commented 5 months ago

@Sveino

kapitkapit commented 4 weeks ago

https://app.adjust.com/34cqh6a_tvv1g60?deeplink=mobilelegends://appinvites/mlr/whatsapp_2000000

The provided URL is an invite link for the mobile game "Mobile Legends" that can be shared via WhatsApp. This link allows users to invite friends to play the game and join the app.

Citations: [1] https://app.adjust.com/34cqh6a_tvv1g60?deeplink=mobilelegends%3A%2F%2Fappinvites%2Fmlr%2Fwhatsapp_2000000 [2] Adding Employees Through the Invite Link - The Connecteam Help Center https://help.connecteam.com/en/articles/6445424-adding-employees-through-the-invite-link [3] Create invite links - App Distribution - Firebase - Google https://firebase.google.com/docs/app-distribution/create-invite-links [4] User referrals | Adjust Help Center https://help.adjust.com/en/article/user-referrals [5] Set up user referrals - Adjust Help Center https://help.adjust.com/en/article/set-up-user-referrals [6] How to correctly use and track App-invites? - Stack Overflow https://stackoverflow.com/questions/37703852/how-to-correctly-use-and-track-app-invites