Skip to content

Ticket update

Markus Sabadello edited this page Nov 16, 2016 · 2 revisions

Any party in the demo can update the train ticket using the following XDI message in JXD format:

[
  {
    "@xdi": [
      "$jxd$xdi",
      "$jxd$xdi$msg",
      "$jxd$xdi$contract",
      {
        "active": "<#active>"
      }
    ],
    "@id": "+!:did:sov:QQiFNVtQCCEFqHagFOd04Q",
    "[$msg]*!:uuid:65ab8bed-501c-4a85-ad8f-222190b2530b": {
      "do": {
        "set-graph": {
          "@type": "@graph",
          "*!:uuid:972ae814-0120-4361-81dc-473f9e8f7536": {
            "active": "false"
          }
        }
      },
      "contract": [
        "(+!:did:sov:QQiFNVtQCCEFqHagFOd04Q/+!:did:sov:QQiFNVtQCCEFqHagFOd04Q)$contract"
      ],
      "to": [
        "(+!:did:sov:QQiFNVtQCCEFqHagFOd04Q)"
      ]
    }
  }
]

In the demo, this message is created and sent programmatically in DeactivateTicketServlet.java.

Some explanations:

  • +!:did:sov:QQiFNVtQCCEFqHagFOd04Q is the ÖBB railway operator, i.e. the sender of the message.
  • *!:uuid:972ae814-0120-4361-81dc-473f9e8f7536 is an identifier for the train ticket.
  • The update is an XDI $set operation on the flag <#active>. This update will trigger the Ticket link contract that will push ticket updates to all subscribing parties.
  • The contract is a reference to the link contract for sending this message. It is a standard link contract that allows ÖBB full access to its own data.
  • The to is the target of the message, i.e. ÖBB itself.