Skip to content
Alpha: see what works today →
Menu

cascade:sourceUrl source URL

https://ns.cascadeprotocol.org/cascade#sourceUrl

A record's full address at its source: for a FHIR resource, its URL on its server; for a contained resource, its container's address, #, and its local id; for a C-CDA record, its HL7 identifier, urn:hl7ii:<root>:<extension>, or its root alone as urn:oid:<root> or urn:uuid:<root>, each character an IRI does not allow percent-encoded as UTF-8. Several records may share one, since a name takes inputs a source address does not. A record named from its document and its place in it, or with no usable identifier, has none.

Type
owl:ObjectProperty
Shapes
  • cascade:OrganizationRecordNameShape, on the subject of any statement of it.
  • cascade:ServerRecordNameShape, on the subject of any statement of it.
  • cascade:SourceUrlShape: nodeKind sh:IRI; maxCount 1 A record has one source address, an IRI.

cascade:OrganizationRecordNameShape checks the subject of any cascade:sourceUrl.

On the whole node: sparql [ a sh:SPARQLConstraint; message "An organization record's name is the one cascade:OrganizationNamingRule gives its source address, its server, Organization and its id: expected {?expected}."; severity sh:Violation; select

SELECT $this ?expected WHERE {
  $this <https://ns.cascadeprotocol.org/cascade#sourceUrl> ?url .
  FILTER EXISTS { $this a <https://ns.cascadeprotocol.org/cascade#Organization> }
  FILTER (ISIRI(?url))
  BIND (STR(?url) AS ?address)
  BIND ("^([Hh][Tt][Tt][Pp][Ss]?)://([A-Za-z0-9.-]+)(:[1-9][0-9]{0,4})?((/[^/?#%]+)*)/([A-Z][A-Za-z]*)/([A-Za-z0-9.-]{1,64})$" AS ?read)
  FILTER (REGEX(?address, ?read))
  BIND (REPLACE(?address, ?read, "$3") AS ?port)
  FILTER (!REGEX(REPLACE(?address, ?read, "$4"), "(^|/)[.][.]?(/|$)") && !REGEX(REPLACE(?address, ?read, "$7"), "^[.]+$"))
  FILTER (!CONTAINS(?address, ""))
  FILTER (?port = "" || <http://www.w3.org/2001/XMLSchema#integer>(SUBSTR(?port, 2)) <= 65535)
  BIND (LCASE(REPLACE(?address, ?read, "$1")) AS ?scheme)
  BIND (CONCAT(?scheme, "://", LCASE(REPLACE(?address, ?read, "$2")),
               IF(?port = "" || (?scheme = "http" && ?port = ":80") || (?scheme = "https" && ?port = ":443"), "", ?port),
               REPLACE(?address, ?read, "$4")) AS ?input1)
  BIND (REPLACE(?address, ?read, "$6") AS ?input2)
  BIND (REPLACE(?address, ?read, "$7") AS ?input3)
  BIND (SHA256(CONCAT("90c60849-c5ef-4ca6-bfb8-8662bd07d2b5|https://ns.cascadeprotocol.org/cascade#OrganizationNamingRule",
                       "|", REPLACE(REPLACE(?input1, "%", "%25"), "\\|", "%7C"),
                       "|", REPLACE(REPLACE(?input2, "%", "%25"), "\\|", "%7C"),
                       COALESCE(CONCAT("|", REPLACE(REPLACE(?input3, "%", "%25"), "\\|", "%7C")), ""))) AS ?hash)
  BIND (REPLACE(REPLACE(REPLACE(REPLACE(SUBSTR(?hash, 17, 1), "[048c]", "8"), "[159d]", "9"), "[26ae]", "a"), "[37bf]", "b")
        AS ?variant)
  BIND (IRI(CONCAT("urn:uuid:", SUBSTR(?hash, 1, 8), "-", SUBSTR(?hash, 9, 4), "-8", SUBSTR(?hash, 14, 3), "-", ?variant,
                   SUBSTR(?hash, 18, 3), "-", SUBSTR(?hash, 21, 12))) AS ?name)
  BIND (?name AS ?expected)
  FILTER ($this != ?expected)
}
]

cascade:ServerRecordNameShape checks the subject of any cascade:sourceUrl.

On the whole node: sparql [ a sh:SPARQLConstraint; message "A record's name, unless it is an organization's, is the one cascade:RecordFromServerNamingRule gives its source address: expected {?expected}."; severity sh:Violation; select

SELECT $this ?expected WHERE {
  $this <https://ns.cascadeprotocol.org/cascade#sourceUrl> ?url .
  FILTER NOT EXISTS { $this a <https://ns.cascadeprotocol.org/cascade#Organization> }
  FILTER (ISIRI(?url))
  BIND (STR(?url) AS ?address)
  BIND ("^([Hh][Tt][Tt][Pp][Ss]?)://([A-Za-z0-9.-]+)(:[1-9][0-9]{0,4})?((/[^/?#%]+)*)/([A-Z][A-Za-z]*)/([A-Za-z0-9.-]{1,64})$" AS ?read)
  FILTER (REGEX(?address, ?read))
  BIND (REPLACE(?address, ?read, "$3") AS ?port)
  FILTER (!REGEX(REPLACE(?address, ?read, "$4"), "(^|/)[.][.]?(/|$)") && !REGEX(REPLACE(?address, ?read, "$7"), "^[.]+$"))
  FILTER (!CONTAINS(?address, ""))
  FILTER (?port = "" || <http://www.w3.org/2001/XMLSchema#integer>(SUBSTR(?port, 2)) <= 65535)
  BIND (LCASE(REPLACE(?address, ?read, "$1")) AS ?scheme)
  BIND (CONCAT(?scheme, "://", LCASE(REPLACE(?address, ?read, "$2")),
               IF(?port = "" || (?scheme = "http" && ?port = ":80") || (?scheme = "https" && ?port = ":443"), "", ?port),
               REPLACE(?address, ?read, "$4")) AS ?input1)
  BIND (REPLACE(?address, ?read, "$6") AS ?input2)
  BIND (REPLACE(?address, ?read, "$7") AS ?input3)
  BIND (SHA256(CONCAT("90c60849-c5ef-4ca6-bfb8-8662bd07d2b5|https://ns.cascadeprotocol.org/cascade#RecordFromServerNamingRule",
                       "|", REPLACE(REPLACE(?input1, "%", "%25"), "\\|", "%7C"),
                       "|", REPLACE(REPLACE(?input2, "%", "%25"), "\\|", "%7C"),
                       "|", REPLACE(REPLACE(?input3, "%", "%25"), "\\|", "%7C"))) AS ?hash)
  BIND (REPLACE(REPLACE(REPLACE(REPLACE(SUBSTR(?hash, 17, 1), "[048c]", "8"), "[159d]", "9"), "[26ae]", "a"), "[37bf]", "b")
        AS ?variant)
  BIND (IRI(CONCAT("urn:uuid:", SUBSTR(?hash, 1, 8), "-", SUBSTR(?hash, 9, 4), "-8", SUBSTR(?hash, 14, 3), "-", ?variant,
                   SUBSTR(?hash, 18, 3), "-", SUBSTR(?hash, 21, 12))) AS ?name)
  BIND (?name AS ?expected)
  FILTER ($this != ?expected)
}
]

cascade:SourceUrlShape checks the subject of any cascade:sourceUrl.

  • cascade:sourceUrl: nodeKind sh:IRI; maxCount 1 A record has one source address, an IRI.
Where it comes from and what uses it
Queries
Rules