diff --git a/examples/qualified-literal-map.json b/examples/qualified-literal-map.json deleted file mode 100644 index f74f19f..0000000 --- a/examples/qualified-literal-map.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "http://www.w3.org/2008/05/skos-xl#prefLabel": { - "prefLabel": { "en": "preferred label", - "values": [ - { - "type": [ "http://www.w3.org/2008/05/skos-xl#Label" ], - "literal": "İstanbul", - "language": "tr", - "rank": "preferred" - }, { - "type": [ "http://www.w3.org/2008/05/skos-xl#Label" ], - "literal": "Constantinople", - "language": "en", - "endDate": "1930" - } - ] - }, - "https://www.wikidata.org/wiki/Property:P395": { - "prefLabel": { "en": "licence plate code" }, - "values": [ - { "literal": "34" } - ] - } -} diff --git a/examples/qualified-literal.concept.json b/examples/qualified-literal.concept.json new file mode 100644 index 0000000..691c3cd --- /dev/null +++ b/examples/qualified-literal.concept.json @@ -0,0 +1,21 @@ +{ + "uri": "http://www.wikidata.org/entity/Q406", + "qualifiedLiterals": { + "http://www.w3.org/2008/05/skos-xl#prefLabel": [ + { + "type": [ "http://www.w3.org/2008/05/skos-xl#Label" ], + "literal": { "@value": "İstanbul", "@language": "tr" }, + "rank": "preferred" + }, { + "type": [ "http://www.w3.org/2008/05/skos-xl#Label" ], + "literal": { "@value": "Constantinople", "@language": "en" }, + "endDate": "1930" + } + ], + "https://www.wikidata.org/wiki/Property:P395": [ + { + "literal": { "@value": "34" } + } + ] + } +} diff --git a/examples/qualified-relation-1.concept.json b/examples/qualified-relation-1.concept.json index 4f351ff..68954cd 100644 --- a/examples/qualified-relation-1.concept.json +++ b/examples/qualified-relation-1.concept.json @@ -2,16 +2,13 @@ "uri": "http://www.wikidata.org/entity/Q42", "prefLabel": { "en": "Douglas Adams" }, "qualifiedRelations": { - "http://www.wikidata.org/entity/P69": { - "prefLabel": { "en": "educated at" }, - "values": [ - { - "resource": { "uri": "http://www.wikidata.org/entity/Q4961791" }, - "startDate": "1959", - "endDate": "1970", - "source": [ { "url": "https://www.brentwoodschool.co.uk/about/our-history/" } ] - } - ] - } + "http://www.wikidata.org/entity/P69": [ + { + "resource": { "uri": "http://www.wikidata.org/entity/Q4961791" }, + "startDate": "1959", + "endDate": "1970", + "source": [ { "url": "https://www.brentwoodschool.co.uk/about/our-history/" } ] + } + ] } } diff --git a/examples/qualified-relation-2.concept.json b/examples/qualified-relation-2.concept.json index dc39888..9c23fb1 100644 --- a/examples/qualified-relation-2.concept.json +++ b/examples/qualified-relation-2.concept.json @@ -2,27 +2,23 @@ "uri": "http://www.wikidata.org/entity/Q3033", "prefLabel": { "en": "Göttingen" }, "qualifiedRelations": { - "http://www.wikidata.org/entity/P17": { - "prefLabel": { "en": "country" }, - "values": [ - { - "resource": { - "uri": "http://www.wikidata.org/entity/Q183", - "prefLabel": { "en": "Germany" } - }, - "startDate": "1990-10-03", - "rank": "preferred" + "http://www.wikidata.org/entity/P17": [ + { + "resource": { + "uri": "http://www.wikidata.org/entity/Q183", + "prefLabel": { "en": "Germany" } }, - { - "resource": { - "uri": "http://www.wikidata.org/entity/Q713750", - "prefLabel": { "en": "West Germany" } - }, - "startDate": "1949-05-23", - "endDate": "1990-10-02", - "rank": "normal" - } - ] - } + "startDate": "1990-10-03", + "rank": "preferred" + },{ + "resource": { + "uri": "http://www.wikidata.org/entity/Q713750", + "prefLabel": { "en": "West Germany" } + }, + "startDate": "1949-05-23", + "endDate": "1990-10-02", + "rank": "normal" + } + ] } } diff --git a/examples/qualified.concept.json b/examples/qualified.concept.json new file mode 100644 index 0000000..025f275 --- /dev/null +++ b/examples/qualified.concept.json @@ -0,0 +1,33 @@ +{ + "uri": "http://www.wikidata.org/entity/Q3033", + "prefLabel": { "en": "Göttingen" }, + "qualifiedRelations": { + "http://www.wikidata.org/entity/P17": [ + { + "resource": { + "uri": "http://www.wikidata.org/entity/Q183", + "prefLabel": { "en": "Germany" } + }, + "startDate": "1990-10-03" + } + ] + }, + "qualifiedLiterals": { + "http://www.w3.org/2008/05/skos-xl#prefLabel": [ + { + "type": [ "http://www.w3.org/2008/05/skos-xl#Label" ], + "literal": { "@value": "Göttingen", "@language": "de" }, + "startDate": "1447", + "_comment": "Davor andere Schreibweisen ohne Umlaut" + } + ] + }, + "qualifiedDates": { + "https://www.wikidata.org/wiki/Property:P571": [ + { + "date": "0953" + } + ] + }, + "_comment": "Nicht exakt Gründungsdatum aber erste Erwähnung" +} diff --git a/jskos.md b/jskos.md index 9cec9cb..e8842af 100644 --- a/jskos.md +++ b/jskos.md @@ -927,28 +927,15 @@ Qualified statements are similar but not identical to properties in a property g The term **qualified statement** refers to the combination of a *property type* and a *qualified value*. Qualified statements are grouped in *qualified maps* by the data type of their qualified values. -A **qualified map** is a JSON object that maps **property types** (each being an [URI]) to objects with the following fields: - -field type definition ------------ --------------------------- ----------------------------------------------------------- -prefLabel [language map] of strings labels of the property type, indexed by language (OPTIONAL) -values array of qualified values qualified values of same qualified data type (REQUIRED) +A **qualified map** is a JSON object that maps **property types** (each being an [URI]) to qualified values. ``` {.json #lst-qualified-map lst-cap="Qualified map with property types from schema.org"} { - "https://schema.org/award": { - "prefLabel": { "en": "award" }, - "values": [ ... ] - }, - "https://schema.org/performerIn": { - "prefLabel": { "en": "performerIn" }, - "values": [ ... ] - } + "https://schema.org/award": [ ... ], + "https://schema.org/performerIn": [ ... ] } ``` -Objects with empty array field `values` SHOULD be ignored. - A **qualified value** is a JSON object with the following optional fields: field type definition @@ -958,8 +945,7 @@ endDate [extended date] date when the statementn ended to be valid source [set] sources as evidence for the statement rank [rank] [rank] of the statement -If field `startDate` is given in a qualified value, the value of field -`endDate` MUST NOT be an interval with open start. +If field `startDate` is given in a qualified value, the value of field `endDate` MUST NOT be an interval with open start. If field `endDate` is given in a qualified value, the value of `startDate` MUST NOT be an interval with open end. @@ -1010,18 +996,14 @@ Applications MAY disallow or ignore qualified dates without field `date`. A **Qualified literal** is a [qualified value] with the following fields (in addition to the optional fields `rank`, `source`, `startDate`, and `endDate`): field type definition ------------ --------------- -------------------------------------------------------------- -literal string character string of the literal (RECOMMENDED) -language [language tag] language of the literal (RECOMMENDED, set to `und` by default) +----------- --------------- ----------------------------------------------------------------------- +literal *see below* character string and optional language tag of the literal (RECOMMENDED) uri [URI] Globally unique identifier of the literal (OPTIONAL) type [list] of [URI] URIs of types (OPTIONAL) - - - -The first element of array field `type`, if given, MUST be . +The value of field `literal` MUST be a JSON objects with REQUIRED field `@value` for the character string and OPTIONAL field `@language` for the language, given as a [language tag]. Application MAY disallow or ignore qualified literals without field `literal`. Applications MAY use `und` as default value when no `@language` is specified. -Application MAY disallow or ignore qualified literals without field `literal`. +The first element of qualified literal array field `type`, if given, MUST be . ::: {.callout-note} Qualified labels allow to express [SKOS eXtension for Labels (SKOS-XL)](https://www.w3.org/TR/skos-reference/#xl) in JSKOS. @@ -1029,7 +1011,7 @@ Qualified labels allow to express [SKOS eXtension for Labels (SKOS-XL)](https:// Qualified statements of data type qualified literal MUST NOT use the property types , , and but they MAY use the corresponding URIs , , and instead. -```{.json #lst-qualified-literal lst-cap="Qualified map of qualified literals"} +```{.json #lst-qualified-literal lst-cap="Concept with qualified literals"} {{< include examples/qualified-literal-map.json >}} ``` diff --git a/schemas/item.schema.json b/schemas/item.schema.json index ee4cc55..1793150 100644 --- a/schemas/item.schema.json +++ b/schemas/item.schema.json @@ -18,6 +18,10 @@ ] } }, + "language-tag": { + "type": "string", + "pattern": "^([a-z]{1,8}(-[a-z0-9]{1,8})*-?|-)$" + }, "language-map": { "type": "object", "patternProperties": { @@ -90,26 +94,6 @@ "type", "items" ] - }, - "edtf": { - "$comment": "EDTF Level 1", - "anyOf": [ - { - "type": "string", - "pattern": "^Y?-?[0-9X]{4,}[?~%]?(-[012X][0-9X][?~%]?(-[0-3X][0-9X][?~%]?)?)?$", - "$comment": "EDTF Year, Year-Month, Year-Month-Day" - }, - { - "type": "string", - "pattern": "^Y?-?[0-9X?~%-]{4,}T[0-9?~%:.]+(Z|[+-][0-9?~%:]+)?$", - "$comment": "EDTF Date and Time" - }, - { - "type": "string", - "pattern": "^(|\\.\\.|[0-9TXYZ%~?.+-]+)/(|\\.\\.|[0-9TXYZ%~?.+-]+)$", - "$comment": "EDTF Interval (very lax)" - } - ] } }, "allOf": [ @@ -168,21 +152,21 @@ }, "startDate": { "description": "date of birth, creation, or estabishment of the item", - "$ref": "#/definitions/edtf" + "$ref": "resource.schema.json#/definitions/edtf" }, "endDate": { "description": "date death or resolution of the item", - "$ref": "#/definitions/edtf" + "$ref": "resource.schema.json#/definitions/edtf" }, "relatedDate": { "description": "other date somehow related to the item (deprecated, use relatedDates instead)", - "$ref": "#/definitions/edtf" + "$ref": "resource.schema.json#/definitions/edtf" }, "relatedDates": { "description": "other date somehow related to the item (deprecated, use relatedDates instead)", "type": "array", "items": { - "$ref": "#/definitions/edtf" + "$ref": "resource.schema.json#/definitions/edtf" } }, "location": { diff --git a/schemas/resource.schema.json b/schemas/resource.schema.json index c3d8cf2..c8bd4fe 100644 --- a/schemas/resource.schema.json +++ b/schemas/resource.schema.json @@ -24,6 +24,13 @@ } ] }, + "type": { + "description": "URIs of types", + "type": "array", + "items": { + "$ref": "#/definitions/uri" + } + }, "non-negative-integer": { "type": "integer", "minimum": 0 @@ -66,6 +73,26 @@ ] } }, + "edtf": { + "$comment": "EDTF Level 1", + "anyOf": [ + { + "type": "string", + "pattern": "^Y?-?[0-9X]{4,}[?~%]?(-[012X][0-9X][?~%]?(-[0-3X][0-9X][?~%]?)?)?$", + "$comment": "EDTF Year, Year-Month, Year-Month-Day" + }, + { + "type": "string", + "pattern": "^Y?-?[0-9X?~%-]{4,}T[0-9?~%:.]+(Z|[+-][0-9?~%:]+)?$", + "$comment": "EDTF Date and Time" + }, + { + "type": "string", + "pattern": "^(|\\.\\.|[0-9TXYZ%~?.+-]+)/(|\\.\\.|[0-9TXYZ%~?.+-]+)$", + "$comment": "EDTF Interval (very lax)" + } + ] + }, "rank": { "type": "string", "enum": ["normal","preferred","deprecated"], @@ -76,11 +103,11 @@ "properties": { "startDate": { "description": "date when the statement started to be valid", - "$ref": "item.schema.json#/definitions/edtf" + "$ref": "#/definitions/edtf" }, "endDate": { "description": "date when the statement ended to be valid", - "$ref": "item.schema.json#/definitions/edtf" + "$ref": "#/definitions/edtf" }, "source": { "description": "sources as evidence for the statement", @@ -90,25 +117,6 @@ "$ref": "#/definitions/rank" } } - }, - "qualifiedRelation": { - "type": "object", - "allOf": [ - { "$ref": "#/definitions/qualifiedValue" } - ], - "properties": { - "resource": { - "description": "object of the relation", - "$ref": "#" - } - }, - "$comment": "TODO: add unevaluatedProperties to disallow undefined properties" - }, - "qualifiedDate": { - "type": "object" - }, - "qualifiedLiteral": { - "type": "object" } }, "properties": { @@ -137,11 +145,7 @@ "$ref": "#/definitions/list" }, "type": { - "description": "URIs of types", - "type": "array", - "items": { - "$ref": "#/definitions/uri" - } + "$ref": "#/definitions/type" }, "created": { "description": "date of creation", @@ -182,33 +186,74 @@ }, "qualifiedRelations": { "type": "object", - "propertyNames": { - "$ref": "#/definitions/uri" - }, + "propertyNames": { "$ref": "#/definitions/uri" }, "patternProperties": { ".*": { - "type": "object", - "properties": { - "prefLabel": { - "description": "labels of the qualified type, indexed by language", - "$ref": "item.schema.json#/definitions/language-map" + "type": "array", + "items": { + "type": "object", + "allOf": [ { "$ref": "#/definitions/qualifiedValue" } ], + "properties": { + "resource": { + "description": "object of the relation", + "$ref": "#" + } }, - "values": { - "description": "qualified values", - "type": "array", - "items": { - "$ref": "#/definitions/qualifiedRelation" + "patternProperties": { "^_|^[A-Z0-9]+$": {} }, + "unevaluatedProperties": false + } + } + } + }, + "qualifiedDates": { + "type": "object", + "propertyNames": { "$ref": "#/definitions/uri" }, + "patternProperties": { + ".*": { + "type": "array", + "items": { + "type": "object", + "allOf": [ { "$ref": "#/definitions/qualifiedValue" } ], + "properties": { + "date": { + "$ref": "#/definitions/edtf" } - } - }, - "required": ["values"], - "additionalProperties": false + }, + "patternProperties": { "^_|^[A-Z0-9]+$": {} }, + "unevaluatedProperties": false + } + } + } + }, + "qualifiedLiterals": { + "type": "object", + "propertyNames": { "$ref": "#/definitions/uri" }, + "patternProperties": { + ".*": { + "type": "array", + "items": { + "type": "object", + "allOf": [ + { "$ref": "#/definitions/qualifiedValue" } + ], + "properties": { + "type": { "$ref": "#/definitions/type" }, + "literal": { + "type": "object", + "properties": { + "@value": { "type": "string" }, + "@language": { "$ref": "item.schema.json#/definitions/language-tag" } + }, + "required": [ "@value" ], + "additionalProperties": false + } + }, + "patternProperties": { "^_|^[A-Z0-9]+$": {} }, + "unevaluatedProperties": false + } } - }, - "additionalProperties": false + } } }, - "patternProperties": { - "^_|^[A-Z0-9]+$": {} - } + "patternProperties": { "^_|^[A-Z0-9]+$": {} } }