From e57aa8db68dfa3084cac6de2b985b13743bb051a Mon Sep 17 00:00:00 2001 From: David Linke Date: Thu, 5 Dec 2024 19:26:15 +0100 Subject: [PATCH] Update examples & generated files after schema change --- example_resource_info.py | 12 +- examples/output/README.md | 0 explore_pydantic.py | 12 +- explore_python.py | 16 +- project/excel/pid4cat_model.xlsx | Bin 7967 -> 8454 bytes project/graphql/pid4cat_model.graphql | 13 +- project/jsonld/pid4cat_model.context.jsonld | 32 +- project/jsonld/pid4cat_model.jsonld | 151 +++++---- project/jsonschema/pid4cat_model.schema.json | 46 ++- project/owl/pid4cat_model.owl.ttl | 316 ++++++++++-------- project/protobuf/pid4cat_model.proto | 13 +- project/shacl/pid4cat_model.shacl.ttl | 158 +++++---- project/shex/pid4cat_model.shex | 15 +- project/sqlschema/pid4cat_model.sql | 32 +- src/pid4cat_model/datamodel/pid4cat_model.py | 81 +++-- .../datamodel/pid4cat_model_pydantic.py | 55 +-- 16 files changed, 563 insertions(+), 389 deletions(-) create mode 100644 examples/output/README.md diff --git a/example_resource_info.py b/example_resource_info.py index 2bf02d7..a07192c 100644 --- a/example_resource_info.py +++ b/example_resource_info.py @@ -5,10 +5,14 @@ label="Resource label", description="Resource description", resource_category=p4c.ResourceCategory.SAMPLE, - rdf_url="https://example.org/resource", - rdf_type="TURTLE", - schema_url="https://example.org/schema", - schema_type="XSD", + representation_variants = [ + p4c.RepresentationVariant( + url="https://example.org/resource", + media_type="text/turtle", + encoding_format="UTF-8", + size=12345, + ), + ], ) print(json_dumper.dumps(pid1_resource_info, inject_type=False)) diff --git a/examples/output/README.md b/examples/output/README.md new file mode 100644 index 0000000..e69de29 diff --git a/explore_pydantic.py b/explore_pydantic.py index 67b1164..78a143d 100644 --- a/explore_pydantic.py +++ b/explore_pydantic.py @@ -20,10 +20,14 @@ label="Resource label", description="Resource description", resource_category=p4c.ResourceCategory.SAMPLE, - rdf_url="https://example.org/resource", - rdf_type="TURTLE", - schema_url="https://example.org/schema", - schema_type="XSD", + representation_variants = [ + p4c.RepresentationVariant( + url="https://example.org/resource", + media_type="text/turtle", + encoding_format="UTF-8", + size=12345, + ), + ], ) p1 = p4c.PID4CatRecord( diff --git a/explore_python.py b/explore_python.py index afe9d0c..9826d64 100644 --- a/explore_python.py +++ b/explore_python.py @@ -15,12 +15,26 @@ description="as requested in issue #234", ) +p1_resource_info = p4c.ResourceInfo( + label="Resource label", + description="Resource description", + resource_category=p4c.ResourceCategory.SAMPLE, + representation_variants = [ + p4c.RepresentationVariant( + url="https://example.org/resource", + media_type="text/turtle", + encoding_format="UTF-8", + size=12345, + ), + ], +) + p1 = p4c.PID4CatRecord( id="lik-1", change_log=p1_log, landing_page_url="https://pid4cat.example.org/lik-1", status=p4c.PID4CatStatus.REGISTERED, # "REGISTERED", - resource_info={}, + resource_info=p1_resource_info, related_identifiers=None, license="CC0-1.0", curation_contact_email="datafuzzi@example.org", diff --git a/project/excel/pid4cat_model.xlsx b/project/excel/pid4cat_model.xlsx index 24466f111d4bafb03fcbc142b1a720b0728af468..988beaff943fb3002604061599bd70996fb69b90 100644 GIT binary patch delta 2614 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 delta 2195 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 N13V!WG-c7%{{Uzxj=BH< diff --git a/project/graphql/pid4cat_model.graphql b/project/graphql/pid4cat_model.graphql index 0b66b2a..02791cd 100644 --- a/project/graphql/pid4cat_model.graphql +++ b/project/graphql/pid4cat_model.graphql @@ -42,14 +42,19 @@ type PID4CatRelation hasAgent: Agent } +type RepresentationVariant + { + url: String + mediaType: String + encodingFormat: String + size: Integer + } + type ResourceInfo { label: String description: String resourceCategory: ResourceCategory - rdfUrl: String - rdfType: String - schemaUrl: String - schemaType: String + representationVariants: [RepresentationVariant] } diff --git a/project/jsonld/pid4cat_model.context.jsonld b/project/jsonld/pid4cat_model.context.jsonld index 038c511..a06a001 100644 --- a/project/jsonld/pid4cat_model.context.jsonld +++ b/project/jsonld/pid4cat_model.context.jsonld @@ -1,7 +1,7 @@ { "comments": { "description": "Auto generated by LinkML jsonld context generator", - "generation_date": "2024-12-05T00:27:03", + "generation_date": "2024-12-05T19:20:01", "source": "pid4cat_model.yaml" }, "@context": { @@ -45,6 +45,9 @@ "email": { "@id": "schema:email" }, + "encoding_format": { + "@id": "encoding_format" + }, "has_agent": { "@type": "@id", "@id": "schema:Agent" @@ -59,6 +62,9 @@ "license": { "@id": "schema:license" }, + "media_type": { + "@id": "schema:encodingFormat" + }, "name": { "@id": "schema:name" }, @@ -68,12 +74,6 @@ "pid_schema_version": { "@id": "schema:identifier" }, - "rdf_type": { - "@id": "schema:additionalType" - }, - "rdf_url": { - "@id": "schema:additionalType" - }, "related_identifier": { "@id": "schema:identifier" }, @@ -90,6 +90,10 @@ }, "@id": "schema:identifier" }, + "representation_variants": { + "@type": "@id", + "@id": "representation_variants" + }, "resource_category": { "@context": { "@vocab": "@null", @@ -112,11 +116,9 @@ }, "@id": "schema:identifier" }, - "schema_type": { - "@id": "schema:additionalType" - }, - "schema_url": { - "@id": "schema:additionalType" + "size": { + "@type": "xsd:integer", + "@id": "schema:fileSize" }, "status": { "@context": { @@ -127,6 +129,9 @@ }, "@id": "status" }, + "url": { + "@id": "schema:URL" + }, "Agent": { "@id": "Agent" }, @@ -142,6 +147,9 @@ "PID4CatRelation": { "@id": "PID4CatRelation" }, + "RepresentationVariant": { + "@id": "RepresentationVariant" + }, "ResourceInfo": { "@id": "ResourceInfo" } diff --git a/project/jsonld/pid4cat_model.jsonld b/project/jsonld/pid4cat_model.jsonld index 5a79856..b4b1187 100644 --- a/project/jsonld/pid4cat_model.jsonld +++ b/project/jsonld/pid4cat_model.jsonld @@ -882,67 +882,18 @@ "@type": "SlotDefinition" }, { - "name": "rdf_url", - "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/rdf_url", - "description": "The URI of the rdf representation of the resource.", + "name": "representation_variants", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/representation_variants", + "description": "The representations of the resource in other media types than text/html.", "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", - "mappings": [ - "http://schema.org/additionalType" - ], - "slot_uri": "http://schema.org/additionalType", - "owner": "ResourceInfo", - "domain_of": [ - "ResourceInfo" - ], - "range": "string", - "@type": "SlotDefinition" - }, - { - "name": "rdf_type", - "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/rdf_type", - "description": "The format of the rdf representation of the resource (xml, turtle, json-ld, ...).", - "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", - "mappings": [ - "http://schema.org/additionalType" - ], - "slot_uri": "http://schema.org/additionalType", - "owner": "ResourceInfo", - "domain_of": [ - "ResourceInfo" - ], - "range": "string", - "@type": "SlotDefinition" - }, - { - "name": "schema_url", - "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/schema_url", - "description": "The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI.", - "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", - "mappings": [ - "http://schema.org/additionalType" - ], - "slot_uri": "http://schema.org/additionalType", - "owner": "ResourceInfo", - "domain_of": [ - "ResourceInfo" - ], - "range": "string", - "@type": "SlotDefinition" - }, - { - "name": "schema_type", - "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/schema_type", - "description": "The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType.", - "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", - "mappings": [ - "http://schema.org/additionalType" - ], - "slot_uri": "http://schema.org/additionalType", + "slot_uri": "https://w3id.org/nfdi4cat/pid4cat-model/representation_variants", + "multivalued": true, "owner": "ResourceInfo", "domain_of": [ "ResourceInfo" ], - "range": "string", + "range": "RepresentationVariant", + "inlined": true, "@type": "SlotDefinition" }, { @@ -1041,6 +992,68 @@ "range": "PID4CatAgentRole", "@type": "SlotDefinition" }, + { + "name": "media_type", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/media_type", + "description": "The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)", + "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", + "mappings": [ + "http://schema.org/encodingFormat" + ], + "slot_uri": "http://schema.org/encodingFormat", + "owner": "RepresentationVariant", + "domain_of": [ + "RepresentationVariant" + ], + "range": "string", + "@type": "SlotDefinition" + }, + { + "name": "encoding_format", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/encoding_format", + "description": "The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels", + "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", + "slot_uri": "https://w3id.org/nfdi4cat/pid4cat-model/encoding_format", + "owner": "RepresentationVariant", + "domain_of": [ + "RepresentationVariant" + ], + "range": "string", + "@type": "SlotDefinition" + }, + { + "name": "size", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/size", + "description": "The size of the representation in bytes.", + "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", + "mappings": [ + "http://schema.org/fileSize" + ], + "slot_uri": "http://schema.org/fileSize", + "owner": "RepresentationVariant", + "domain_of": [ + "RepresentationVariant" + ], + "range": "integer", + "minimum_value": 0, + "@type": "SlotDefinition" + }, + { + "name": "url", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/url", + "description": "The URL of the representation.", + "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", + "mappings": [ + "http://schema.org/URL" + ], + "slot_uri": "http://schema.org/URL", + "owner": "RepresentationVariant", + "domain_of": [ + "RepresentationVariant" + ], + "range": "string", + "@type": "SlotDefinition" + }, { "name": "container__contains_pids", "description": "The PID4CatRecords contained in the container.", @@ -1147,10 +1160,7 @@ "label", "description", "resource_category", - "rdf_url", - "rdf_type", - "schema_url", - "schema_type" + "representation_variants" ], "slot_usage": {}, "class_uri": "https://w3id.org/nfdi4cat/pid4cat-model/ResourceInfo", @@ -1187,6 +1197,21 @@ "class_uri": "https://w3id.org/nfdi4cat/pid4cat-model/Agent", "@type": "ClassDefinition" }, + { + "name": "RepresentationVariant", + "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/RepresentationVariant", + "description": "A representation of the resource in other media types than text/html which is the default for landing_page_url.", + "from_schema": "https://w3id.org/nfdi4cat/pid4cat-model", + "slots": [ + "url", + "media_type", + "encoding_format", + "size" + ], + "slot_usage": {}, + "class_uri": "https://w3id.org/nfdi4cat/pid4cat-model/RepresentationVariant", + "@type": "ClassDefinition" + }, { "name": "Container", "definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/Container", @@ -1213,9 +1238,9 @@ ], "metamodel_version": "1.7.0", "source_file": "pid4cat_model.yaml", - "source_file_date": "2024-12-04T23:36:00", - "source_file_size": 13015, - "generation_date": "2024-12-05T00:27:03", + "source_file_date": "2024-12-05T19:05:07", + "source_file_size": 13348, + "generation_date": "2024-12-05T19:20:01", "@type": "SchemaDefinition", "@context": [ "project/jsonld/pid4cat_model.context.jsonld", diff --git a/project/jsonschema/pid4cat_model.schema.json b/project/jsonschema/pid4cat_model.schema.json index a46f5ce..8d1b364 100644 --- a/project/jsonschema/pid4cat_model.schema.json +++ b/project/jsonschema/pid4cat_model.schema.json @@ -223,6 +223,31 @@ "title": "RelationType", "type": "string" }, + "RepresentationVariant": { + "additionalProperties": false, + "description": "A representation of the resource in other media types than text/html which is the default for landing_page_url.", + "properties": { + "encoding_format": { + "description": "The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels", + "type": "string" + }, + "media_type": { + "description": "The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)", + "type": "string" + }, + "size": { + "description": "The size of the representation in bytes.", + "minimum": 0, + "type": "integer" + }, + "url": { + "description": "The URL of the representation.", + "type": "string" + } + }, + "title": "RepresentationVariant", + "type": "object" + }, "ResourceCategory": { "description": "The category of the resource", "enum": [ @@ -248,25 +273,16 @@ "description": "A human-readable name for a resource.", "type": "string" }, - "rdf_type": { - "description": "The format of the rdf representation of the resource (xml, turtle, json-ld, ...).", - "type": "string" - }, - "rdf_url": { - "description": "The URI of the rdf representation of the resource.", - "type": "string" + "representation_variants": { + "description": "The representations of the resource in other media types than text/html.", + "items": { + "$ref": "#/$defs/RepresentationVariant" + }, + "type": "array" }, "resource_category": { "$ref": "#/$defs/ResourceCategory", "description": "The category of the resource." - }, - "schema_type": { - "description": "The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType.", - "type": "string" - }, - "schema_url": { - "description": "The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI.", - "type": "string" } }, "title": "ResourceInfo", diff --git a/project/owl/pid4cat_model.owl.ttl b/project/owl/pid4cat_model.owl.ttl index 2969d6a..afeea23 100644 --- a/project/owl/pid4cat_model.owl.ttl +++ b/project/owl/pid4cat_model.owl.ttl @@ -15,10 +15,10 @@ pid4cat_model:Container a owl:Class, linkml:ClassDefinition ; rdfs:label "Container" ; rdfs:subClassOf [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom pid4cat_model:PID4CatRecord ; owl:onProperty pid4cat_model:contains_pids ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:PID4CatRecord ; + owl:minCardinality 0 ; owl:onProperty pid4cat_model:contains_pids ] ; skos:definition "A container for all PID4Cat instances." ; skos:inScheme . @@ -27,20 +27,11 @@ pid4cat_model:PID4CatRecord a owl:Class, linkml:ClassDefinition ; rdfs:label "PID4CatRecord" ; rdfs:subClassOf [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:related_identifiers ], - [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:pid_schema_version ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:resource_info ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:landing_page_url ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:resource_info ], + owl:onProperty pid4cat_model:curation_contact_email ], [ a owl:Restriction ; owl:allValuesFrom pid4cat_model:ResourceInfo ; owl:onProperty pid4cat_model:resource_info ], @@ -48,61 +39,70 @@ pid4cat_model:PID4CatRecord a owl:Class, owl:maxCardinality 1 ; owl:onProperty pid4cat_model:pid_schema_version ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom pid4cat_model:PID4CatStatus ; owl:onProperty pid4cat_model:status ], [ a owl:Restriction ; owl:allValuesFrom linkml:Uriorcurie ; owl:onProperty pid4cat_model:id ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:license ], + owl:onProperty pid4cat_model:id ], [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:license ], + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:landing_page_url ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:LogRecord ; - owl:onProperty pid4cat_model:change_log ], + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:curation_contact_email ], + [ a owl:Restriction ; + owl:allValuesFrom pid4cat_model:PID4CatRelation ; + owl:onProperty pid4cat_model:related_identifiers ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:license ], + owl:onProperty pid4cat_model:resource_info ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:landing_page_url ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:resource_info ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:pid_schema_version ], + owl:onProperty pid4cat_model:license ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:id ], + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:status ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:curation_contact_email ], + owl:onProperty pid4cat_model:landing_page_url ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:PID4CatStatus ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:pid_schema_version ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; owl:onProperty pid4cat_model:status ], [ a owl:Restriction ; owl:minCardinality 1 ; owl:onProperty pid4cat_model:id ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:PID4CatRelation ; + owl:minCardinality 0 ; owl:onProperty pid4cat_model:related_identifiers ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:curation_contact_email ], + owl:onProperty pid4cat_model:license ], [ a owl:Restriction ; owl:allValuesFrom [ a rdfs:Datatype ; owl:onDatatype xsd:string ; owl:withRestrictions ( [ xsd:pattern "^\\S+@[\\S+\\.]+\\S+" ] ) ] ; owl:onProperty pid4cat_model:curation_contact_email ], - [ a owl:Restriction ; - owl:minCardinality 1 ; - owl:onProperty pid4cat_model:change_log ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:landing_page_url ], + owl:onProperty pid4cat_model:license ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:status ] ; + owl:allValuesFrom pid4cat_model:LogRecord ; + owl:onProperty pid4cat_model:change_log ], + [ a owl:Restriction ; + owl:minCardinality 1 ; + owl:onProperty pid4cat_model:change_log ] ; skos:definition "Represents a PID4CatRecord" ; skos:inScheme . @@ -190,38 +190,38 @@ pid4cat_model:LogRecord a owl:Class, linkml:ClassDefinition ; rdfs:label "LogRecord" ; rdfs:subClassOf [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:changed_field ], + owl:allValuesFrom pid4cat_model:Agent ; + owl:onProperty pid4cat_model:has_agent ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:maxCardinality 1 ; owl:onProperty pid4cat_model:description ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:datetime_log ], + owl:onProperty pid4cat_model:description ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:description ], + owl:onProperty pid4cat_model:has_agent ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:datetime_log ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:changed_field ], [ a owl:Restriction ; owl:allValuesFrom pid4cat_model:ChangeLogField ; owl:onProperty pid4cat_model:changed_field ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty pid4cat_model:has_agent ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:has_agent ], - [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:Agent ; - owl:onProperty pid4cat_model:has_agent ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:description ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:changed_field ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:changed_field ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:datetime_log ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty pid4cat_model:datetime_log ] ; @@ -242,38 +242,38 @@ pid4cat_model:PID4CatRelation a owl:Class, linkml:ClassDefinition ; rdfs:label "PID4CatRelation" ; rdfs:subClassOf [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:has_agent ], + [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty pid4cat_model:related_identifier ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:has_agent ], + owl:onProperty pid4cat_model:datetime_log ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:related_identifier ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:Agent ; - owl:onProperty pid4cat_model:has_agent ], - [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:RelationType ; - owl:onProperty pid4cat_model:relation_type ], + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:datetime_log ], [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty pid4cat_model:has_agent ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:relation_type ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:datetime_log ], [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:datetime_log ], + owl:allValuesFrom pid4cat_model:RelationType ; + owl:onProperty pid4cat_model:relation_type ], [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:related_identifier ], + owl:allValuesFrom pid4cat_model:Agent ; + owl:onProperty pid4cat_model:has_agent ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:datetime_log ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:relation_type ] ; + owl:onProperty pid4cat_model:related_identifier ] ; skos:definition "A relation between PID4CatRecords or between a PID4CatRecord and other resources with a PID." ; skos:inScheme . @@ -432,6 +432,51 @@ pid4cat_model:PID4CatRelation a owl:Class, rdfs:label "REFERENCES" ; rdfs:subClassOf pid4cat_model:RelationType . +pid4cat_model:RepresentationVariant a owl:Class, + linkml:ClassDefinition ; + rdfs:label "RepresentationVariant" ; + rdfs:subClassOf [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:size ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:encoding_format ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:url ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:String ; + owl:onProperty pid4cat_model:media_type ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:media_type ], + [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:size ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:encoding_format ], + [ a owl:Restriction ; + owl:allValuesFrom [ a rdfs:Datatype ; + owl:intersectionOf ( linkml:Integer [ a rdfs:Datatype ; + owl:onDatatype xsd:integer ; + owl:withRestrictions ( [ xsd:minInclusive 0 ] ) ] ) ] ; + owl:onProperty pid4cat_model:size ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:url ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:String ; + owl:onProperty pid4cat_model:url ], + [ a owl:Restriction ; + owl:allValuesFrom linkml:String ; + owl:onProperty pid4cat_model:encoding_format ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:media_type ] ; + skos:definition "A representation of the resource in other media types than text/html which is the default for landing_page_url." ; + skos:inScheme . + a owl:Class, pid4cat_model:ResourceCategory ; rdfs:label "DEVICE" ; @@ -446,23 +491,11 @@ pid4cat_model:ResourceInfo a owl:Class, linkml:ClassDefinition ; rdfs:label "ResourceInfo" ; rdfs:subClassOf [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:description ], + owl:allValuesFrom pid4cat_model:RepresentationVariant ; + owl:onProperty pid4cat_model:representation_variants ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:rdf_type ], - [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:ResourceCategory ; - owl:onProperty pid4cat_model:resource_category ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:description ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:resource_category ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:label ], + owl:onProperty pid4cat_model:representation_variants ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty pid4cat_model:resource_category ], @@ -471,43 +504,25 @@ pid4cat_model:ResourceInfo a owl:Class, owl:onProperty pid4cat_model:label ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:schema_type ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:rdf_url ], + owl:onProperty pid4cat_model:resource_category ], [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:rdf_type ], + owl:allValuesFrom pid4cat_model:ResourceCategory ; + owl:onProperty pid4cat_model:resource_category ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:rdf_url ], + owl:onProperty pid4cat_model:description ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 0 ; owl:onProperty pid4cat_model:description ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:schema_url ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:rdf_type ], - [ a owl:Restriction ; - owl:allValuesFrom linkml:String ; owl:onProperty pid4cat_model:label ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:schema_type ], + owl:onProperty pid4cat_model:label ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:schema_url ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:schema_url ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:rdf_url ], - [ a owl:Restriction ; - owl:minCardinality 0 ; - owl:onProperty pid4cat_model:schema_type ] ; + owl:onProperty pid4cat_model:description ] ; skos:definition "Data object to hold information about the resource and its representation." ; skos:inScheme . @@ -538,56 +553,63 @@ pid4cat_model:relation_type a owl:ObjectProperty, skos:definition "Relation type between the resources." ; skos:inScheme . +pid4cat_model:representation_variants a owl:ObjectProperty, + linkml:SlotDefinition ; + rdfs:label "representation_variants" ; + rdfs:range pid4cat_model:RepresentationVariant ; + skos:definition "The representations of the resource in other media types than text/html." ; + skos:inScheme . + pid4cat_model:Agent a owl:Class, linkml:ClassDefinition ; rdfs:label "Agent" ; rdfs:subClassOf [ a owl:Restriction ; + owl:minCardinality 0 ; + owl:onProperty pid4cat_model:name ], + [ a owl:Restriction ; owl:maxCardinality 1 ; owl:onProperty pid4cat_model:orcid ], - [ a owl:Restriction ; - owl:allValuesFrom [ a rdfs:Datatype ; - owl:onDatatype xsd:string ; - owl:withRestrictions ( [ xsd:pattern "^\\S+@[\\S+\\.]+\\S+" ] ) ] ; - owl:onProperty pid4cat_model:email ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:name ], - [ a owl:Restriction ; - owl:minCardinality 0 ; owl:onProperty pid4cat_model:affiliation_ror ], [ a owl:Restriction ; owl:minCardinality 0 ; owl:onProperty pid4cat_model:orcid ], [ a owl:Restriction ; - owl:maxCardinality 1 ; + owl:minCardinality 0 ; owl:onProperty pid4cat_model:role ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:email ], + owl:onProperty pid4cat_model:affiliation_ror ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:affiliation_ror ], + [ a owl:Restriction ; + owl:maxCardinality 1 ; + owl:onProperty pid4cat_model:name ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:orcid ], + owl:onProperty pid4cat_model:name ], [ a owl:Restriction ; - owl:allValuesFrom pid4cat_model:PID4CatAgentRole ; - owl:onProperty pid4cat_model:role ], + owl:allValuesFrom [ a rdfs:Datatype ; + owl:onDatatype xsd:string ; + owl:withRestrictions ( [ xsd:pattern "^\\S+@[\\S+\\.]+\\S+" ] ) ] ; + owl:onProperty pid4cat_model:email ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:email ], + owl:onProperty pid4cat_model:role ], [ a owl:Restriction ; - owl:minCardinality 0 ; + owl:allValuesFrom pid4cat_model:PID4CatAgentRole ; owl:onProperty pid4cat_model:role ], [ a owl:Restriction ; owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:name ], + owl:onProperty pid4cat_model:email ], [ a owl:Restriction ; owl:allValuesFrom linkml:String ; - owl:onProperty pid4cat_model:affiliation_ror ], + owl:onProperty pid4cat_model:orcid ], [ a owl:Restriction ; owl:minCardinality 0 ; - owl:onProperty pid4cat_model:name ], - [ a owl:Restriction ; - owl:maxCardinality 1 ; - owl:onProperty pid4cat_model:affiliation_ror ] ; + owl:onProperty pid4cat_model:email ] ; skos:definition "Person who plays a role relative to PID creation or curation." ; skos:inScheme . @@ -616,6 +638,12 @@ pid4cat_model:email a owl:ObjectProperty, skos:definition "Email address of the agent that created or modified the PID record." ; skos:inScheme . +pid4cat_model:encoding_format a owl:ObjectProperty, + linkml:SlotDefinition ; + rdfs:label "encoding_format" ; + skos:definition "The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels" ; + skos:inScheme . + pid4cat_model:id a owl:ObjectProperty, linkml:SlotDefinition ; rdfs:label "id" ; @@ -642,6 +670,12 @@ pid4cat_model:license a owl:ObjectProperty, skos:definition "The license for the metadata contained in the PID4Cat record." ; skos:inScheme . +pid4cat_model:media_type a owl:ObjectProperty, + linkml:SlotDefinition ; + rdfs:label "media_type" ; + skos:definition "The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)" ; + skos:inScheme . + pid4cat_model:name a owl:ObjectProperty, linkml:SlotDefinition ; rdfs:label "name" ; @@ -660,18 +694,6 @@ pid4cat_model:pid_schema_version a owl:ObjectProperty, skos:definition "The version of the PID4Cat schema used for the PID4CatRecord." ; skos:inScheme . -pid4cat_model:rdf_type a owl:ObjectProperty, - linkml:SlotDefinition ; - rdfs:label "rdf_type" ; - skos:definition "The format of the rdf representation of the resource (xml, turtle, json-ld, ...)." ; - skos:inScheme . - -pid4cat_model:rdf_url a owl:ObjectProperty, - linkml:SlotDefinition ; - rdfs:label "rdf_url" ; - skos:definition "The URI of the rdf representation of the resource." ; - skos:inScheme . - pid4cat_model:related_identifier a owl:ObjectProperty, linkml:SlotDefinition ; rdfs:label "related_identifier" ; @@ -699,16 +721,14 @@ pid4cat_model:role a owl:ObjectProperty, skos:definition "The role of the agent relative to the resource" ; skos:inScheme . -pid4cat_model:schema_type a owl:ObjectProperty, - linkml:SlotDefinition ; - rdfs:label "schema_type" ; - skos:definition "The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType." ; - skos:inScheme . - -pid4cat_model:schema_url a owl:ObjectProperty, +pid4cat_model:size a owl:ObjectProperty, linkml:SlotDefinition ; - rdfs:label "schema_url" ; - skos:definition "The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI." ; + rdfs:label "size" ; + rdfs:range [ a rdfs:Datatype ; + owl:intersectionOf ( linkml:Integer [ a rdfs:Datatype ; + owl:onDatatype xsd:integer ; + owl:withRestrictions ( [ xsd:minInclusive 0 ] ) ] ) ] ; + skos:definition "The size of the representation in bytes." ; skos:inScheme . pid4cat_model:status a owl:ObjectProperty, @@ -718,6 +738,12 @@ pid4cat_model:status a owl:ObjectProperty, skos:definition "The status of the PID4CatRecord." ; skos:inScheme . +pid4cat_model:url a owl:ObjectProperty, + linkml:SlotDefinition ; + rdfs:label "url" ; + skos:definition "The URL of the representation." ; + skos:inScheme . + pid4cat_model:PID4CatAgentRole a owl:Class, linkml:EnumDefinition ; owl:unionOf ( ) ; diff --git a/project/protobuf/pid4cat_model.proto b/project/protobuf/pid4cat_model.proto index 11780ae..fcbc933 100644 --- a/project/protobuf/pid4cat_model.proto +++ b/project/protobuf/pid4cat_model.proto @@ -44,14 +44,19 @@ message PID4CatRelation string datetimeLog = 0 agent hasAgent = 0 } +// A representation of the resource in other media types than text/html which is the default for landing_page_url. +message RepresentationVariant + { + string url = 0 + string mediaType = 0 + string encodingFormat = 0 + integer size = 0 + } // Data object to hold information about the resource and its representation. message ResourceInfo { string label = 0 string description = 0 resourceCategory resourceCategory = 0 - string rdfUrl = 0 - string rdfType = 0 - string schemaUrl = 0 - string schemaType = 0 + repeated representationVariant representationVariants = 0 } diff --git a/project/shacl/pid4cat_model.shacl.ttl b/project/shacl/pid4cat_model.shacl.ttl index 9c76913..162c746 100644 --- a/project/shacl/pid4cat_model.shacl.ttl +++ b/project/shacl/pid4cat_model.shacl.ttl @@ -23,48 +23,46 @@ pid4cat_model:LogRecord a sh:NodeShape ; sh:closed true ; sh:description "A log record for changes made on a PID4CatRecord starting from registration." ; sh:ignoredProperties ( rdf:type ) ; - sh:property [ sh:datatype xsd:string ; - sh:description "The date and time of a log record." ; - sh:maxCount 1 ; - sh:order 0 ; - sh:path schema1:DateTime ], - [ sh:description "The field that was changed" ; - sh:in ( "STATUS" "RESOURCE_INFO" "RELATED_IDS" "CONTACT" "LICENSE" ) ; - sh:maxCount 1 ; - sh:order 2 ; - sh:path schema1:identifier ], - [ sh:class pid4cat_model:Agent ; + sh:property [ sh:class pid4cat_model:Agent ; sh:description "The person who registered the resource." ; sh:maxCount 1 ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 1 ; sh:path schema1:Agent ], + [ sh:datatype xsd:string ; + sh:description "The date and time of a log record." ; + sh:maxCount 1 ; + sh:order 0 ; + sh:path schema1:DateTime ], [ sh:datatype xsd:string ; sh:description "A human-readable description for a resource." ; sh:maxCount 1 ; sh:order 3 ; - sh:path schema1:description ] ; + sh:path schema1:description ], + [ sh:description "The field that was changed" ; + sh:in ( "STATUS" "RESOURCE_INFO" "RELATED_IDS" "CONTACT" "LICENSE" ) ; + sh:maxCount 1 ; + sh:order 2 ; + sh:path schema1:identifier ] ; sh:targetClass pid4cat_model:LogRecord . pid4cat_model:PID4CatRecord a sh:NodeShape ; sh:closed true ; sh:description "Represents a PID4CatRecord" ; sh:ignoredProperties ( rdf:type ) ; - sh:property [ sh:description "The status of the PID4CatRecord." ; - sh:in ( "SUBMITTED" "REGISTERED" "OBSOLETED" "DEPRECATED" ) ; + sh:property [ sh:datatype xsd:string ; + sh:description "The version of the PID4Cat schema used for the PID4CatRecord." ; sh:maxCount 1 ; - sh:order 2 ; - sh:path pid4cat_model:status ], - [ sh:class pid4cat_model:LogRecord ; - sh:description "Change log of PID4Cat record." ; - sh:minCount 1 ; + sh:order 3 ; + sh:path schema1:identifier ], + [ sh:class pid4cat_model:PID4CatRelation ; + sh:description "Relations of the resource to other identifiers." ; sh:nodeKind sh:BlankNodeOrIRI ; - sh:order 8 ; + sh:order 7 ; sh:path schema1:identifier ], - [ sh:datatype xsd:string ; - sh:description "The version of the PID4Cat schema used for the PID4CatRecord." ; + [ sh:description "A unique identifier for a thing." ; sh:maxCount 1 ; - sh:order 3 ; + sh:order 0 ; sh:path schema1:identifier ], [ sh:datatype xsd:string ; sh:description "The email address of a person or institution currently responsible for the curation of the PID record." ; @@ -72,31 +70,33 @@ pid4cat_model:PID4CatRecord a sh:NodeShape ; sh:order 5 ; sh:path schema1:email ; sh:pattern "^\\S+@[\\S+\\.]+\\S+" ], - [ sh:datatype xsd:string ; - sh:description "The URL of the landing page for the resource." ; + [ sh:class pid4cat_model:LogRecord ; + sh:description "Change log of PID4Cat record." ; + sh:minCount 1 ; + sh:nodeKind sh:BlankNodeOrIRI ; + sh:order 8 ; + sh:path schema1:identifier ], + [ sh:description "The status of the PID4CatRecord." ; + sh:in ( "SUBMITTED" "REGISTERED" "OBSOLETED" "DEPRECATED" ) ; sh:maxCount 1 ; - sh:order 1 ; - sh:path schema1:url ], + sh:order 2 ; + sh:path pid4cat_model:status ], [ sh:class pid4cat_model:ResourceInfo ; sh:description "Information about the resource." ; sh:maxCount 1 ; sh:nodeKind sh:BlankNodeOrIRI ; sh:order 6 ; sh:path pid4cat_model:resource_info ], - [ sh:class pid4cat_model:PID4CatRelation ; - sh:description "Relations of the resource to other identifiers." ; - sh:nodeKind sh:BlankNodeOrIRI ; - sh:order 7 ; - sh:path schema1:identifier ], - [ sh:description "A unique identifier for a thing." ; - sh:maxCount 1 ; - sh:order 0 ; - sh:path schema1:identifier ], [ sh:datatype xsd:string ; sh:description "The license for the metadata contained in the PID4Cat record." ; sh:maxCount 1 ; sh:order 4 ; - sh:path schema1:license ] ; + sh:path schema1:license ], + [ sh:datatype xsd:string ; + sh:description "The URL of the landing page for the resource." ; + sh:maxCount 1 ; + sh:order 1 ; + sh:path schema1:url ] ; sh:targetClass pid4cat_model:PID4CatRecord . pid4cat_model:PID4CatRelation a sh:NodeShape ; @@ -114,56 +114,68 @@ pid4cat_model:PID4CatRelation a sh:NodeShape ; sh:maxCount 1 ; sh:order 2 ; sh:path schema1:DateTime ], + [ sh:description "Relation type between the resources." ; + sh:in ( "IS_CITED_BY" "CITES" "IS_SUPPLEMENT_TO" "IS_SUPPLEMENTED_BY" "IS_CONTINUED_BY" "CONTINUES" "HAS_METADATA" "IS_METADATA_FOR" dcterms:hasVersion dcterms:isVersionOf "IS_NEW_VERSION_OF" "IS_PREVIOUS_VERSION_OF" dcterms:isPartOf dcterms:hasPart "IS_DESCRIBED_BY" "DESCRIBES" "IS_PUBLISHED_IN" dcterms:isReferencedBy "REFERENCES" "IS_DOCUMENTED_BY" "DOCUMENTS" "IS_COMPILED_BY" "COMPILES" "IS_VARIANT_FORM_OF" "IS_ORIGINAL_FORM_OF" "IS_IDENTICAL_TO" "IS_DERIVED_FROM" "IS_SOURCE_OF" "IS_COLLECTED_BY" "COLLECTS" dcterms:isRequiredBy dcterms:requires "IS_OBSOLETED_BY" "OBSOLETES" ) ; + sh:order 0 ; + sh:path schema1:identifier ], [ sh:datatype xsd:string ; sh:description "Related identifiers for the resource." ; sh:maxCount 1 ; sh:order 1 ; - sh:path schema1:identifier ], - [ sh:description "Relation type between the resources." ; - sh:in ( "IS_CITED_BY" "CITES" "IS_SUPPLEMENT_TO" "IS_SUPPLEMENTED_BY" "IS_CONTINUED_BY" "CONTINUES" "HAS_METADATA" "IS_METADATA_FOR" dcterms:hasVersion dcterms:isVersionOf "IS_NEW_VERSION_OF" "IS_PREVIOUS_VERSION_OF" dcterms:isPartOf dcterms:hasPart "IS_DESCRIBED_BY" "DESCRIBES" "IS_PUBLISHED_IN" dcterms:isReferencedBy "REFERENCES" "IS_DOCUMENTED_BY" "DOCUMENTS" "IS_COMPILED_BY" "COMPILES" "IS_VARIANT_FORM_OF" "IS_ORIGINAL_FORM_OF" "IS_IDENTICAL_TO" "IS_DERIVED_FROM" "IS_SOURCE_OF" "IS_COLLECTED_BY" "COLLECTS" dcterms:isRequiredBy dcterms:requires "IS_OBSOLETED_BY" "OBSOLETES" ) ; - sh:order 0 ; sh:path schema1:identifier ] ; sh:targetClass pid4cat_model:PID4CatRelation . -pid4cat_model:ResourceInfo a sh:NodeShape ; +pid4cat_model:RepresentationVariant a sh:NodeShape ; sh:closed true ; - sh:description "Data object to hold information about the resource and its representation." ; + sh:description "A representation of the resource in other media types than text/html which is the default for landing_page_url." ; sh:ignoredProperties ( rdf:type ) ; - sh:property [ sh:datatype xsd:string ; - sh:description "The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI." ; + sh:property [ sh:datatype xsd:integer ; + sh:description "The size of the representation in bytes." ; sh:maxCount 1 ; - sh:order 5 ; - sh:path schema1:additionalType ], + sh:minInclusive 0 ; + sh:order 3 ; + sh:path schema1:fileSize ], [ sh:datatype xsd:string ; - sh:description "A human-readable description for a resource." ; + sh:description "The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)" ; sh:maxCount 1 ; sh:order 1 ; - sh:path schema1:description ], + sh:path schema1:encodingFormat ], [ sh:datatype xsd:string ; - sh:description "A human-readable name for a resource." ; + sh:description "The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels" ; sh:maxCount 1 ; - sh:order 0 ; - sh:path schema1:name ], + sh:order 2 ; + sh:path pid4cat_model:encoding_format ], [ sh:datatype xsd:string ; - sh:description "The format of the rdf representation of the resource (xml, turtle, json-ld, ...)." ; + sh:description "The URL of the representation." ; sh:maxCount 1 ; - sh:order 4 ; - sh:path schema1:additionalType ], + sh:order 0 ; + sh:path schema1:URL ] ; + sh:targetClass pid4cat_model:RepresentationVariant . + +pid4cat_model:ResourceInfo a sh:NodeShape ; + sh:closed true ; + sh:description "Data object to hold information about the resource and its representation." ; + sh:ignoredProperties ( rdf:type ) ; + sh:property [ sh:class pid4cat_model:RepresentationVariant ; + sh:description "The representations of the resource in other media types than text/html." ; + sh:nodeKind sh:BlankNodeOrIRI ; + sh:order 3 ; + sh:path pid4cat_model:representation_variants ], [ sh:datatype xsd:string ; - sh:description "The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType." ; + sh:description "A human-readable name for a resource." ; sh:maxCount 1 ; - sh:order 6 ; - sh:path schema1:additionalType ], + sh:order 0 ; + sh:path schema1:name ], [ sh:description "The category of the resource." ; sh:in ( dcmitype:Collection sosa:Sample "MATERIAL" "DEVICE" DCAT:dataset DCAT:DataService ) ; sh:maxCount 1 ; sh:order 2 ; sh:path schema1:additionalType ], [ sh:datatype xsd:string ; - sh:description "The URI of the rdf representation of the resource." ; + sh:description "A human-readable description for a resource." ; sh:maxCount 1 ; - sh:order 3 ; - sh:path schema1:additionalType ] ; + sh:order 1 ; + sh:path schema1:description ] ; sh:targetClass pid4cat_model:ResourceInfo . pid4cat_model:Agent a sh:NodeShape ; @@ -171,10 +183,21 @@ pid4cat_model:Agent a sh:NodeShape ; sh:description "Person who plays a role relative to PID creation or curation." ; sh:ignoredProperties ( rdf:type ) ; sh:property [ sh:datatype xsd:string ; + sh:description "Email address of the agent that created or modified the PID record." ; + sh:maxCount 1 ; + sh:order 1 ; + sh:path schema1:email ; + sh:pattern "^\\S+@[\\S+\\.]+\\S+" ], + [ sh:datatype xsd:string ; sh:description "The ROR of the agent's affiliation." ; sh:maxCount 1 ; sh:order 3 ; sh:path schema1:identifier ], + [ sh:description "The role of the agent relative to the resource" ; + sh:in ( "TRUSTEE" "OWNER" ) ; + sh:maxCount 1 ; + sh:order 4 ; + sh:path schema1:identifier ], [ sh:datatype xsd:string ; sh:description "The ORCID of the person" ; sh:maxCount 1 ; @@ -184,17 +207,6 @@ pid4cat_model:Agent a sh:NodeShape ; sh:description "The name of the agent that created or modified the PID record." ; sh:maxCount 1 ; sh:order 0 ; - sh:path schema1:name ], - [ sh:description "The role of the agent relative to the resource" ; - sh:in ( "TRUSTEE" "OWNER" ) ; - sh:maxCount 1 ; - sh:order 4 ; - sh:path schema1:identifier ], - [ sh:datatype xsd:string ; - sh:description "Email address of the agent that created or modified the PID record." ; - sh:maxCount 1 ; - sh:order 1 ; - sh:path schema1:email ; - sh:pattern "^\\S+@[\\S+\\.]+\\S+" ] ; + sh:path schema1:name ] ; sh:targetClass pid4cat_model:Agent . diff --git a/project/shex/pid4cat_model.shex b/project/shex/pid4cat_model.shex index 131b666..1accce3 100644 --- a/project/shex/pid4cat_model.shex +++ b/project/shex/pid4cat_model.shex @@ -133,16 +133,23 @@ linkml:Sparqlpath xsd:string ) } + CLOSED { + ( $ ( schema1:URL @linkml:String ? ; + schema1:encodingFormat @linkml:String ? ; + @linkml:String ? ; + schema1:fileSize @linkml:Integer ? + ) ; + rdf:type [ ] ? + ) +} + CLOSED { ( $ ( schema1:name @linkml:String ? ; schema1:description @linkml:String ? ; schema1:additionalType [ dcmitype:Collection sosa:Sample DCAT:dataset DCAT:DataService ] ? ; - schema1:additionalType @linkml:String ? ; - schema1:additionalType @linkml:String ? ; - schema1:additionalType @linkml:String ? ; - schema1:additionalType @linkml:String ? + @ * ) ; rdf:type [ ] ? ) diff --git a/project/sqlschema/pid4cat_model.sql b/project/sqlschema/pid4cat_model.sql index bff1db5..c64d8ab 100644 --- a/project/sqlschema/pid4cat_model.sql +++ b/project/sqlschema/pid4cat_model.sql @@ -17,10 +17,6 @@ -- * Slot: label Description: A human-readable name for a resource. -- * Slot: description Description: A human-readable description for a resource. -- * Slot: resource_category Description: The category of the resource. --- * Slot: rdf_url Description: The URI of the rdf representation of the resource. --- * Slot: rdf_type Description: The format of the rdf representation of the resource (xml, turtle, json-ld, ...). --- * Slot: schema_url Description: The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI. --- * Slot: schema_type Description: The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType. -- # Class: "LogRecord" Description: "A log record for changes made on a PID4CatRecord starting from registration." -- * Slot: id Description: -- * Slot: datetime_log Description: The date and time of a log record. @@ -34,6 +30,12 @@ -- * Slot: orcid Description: The ORCID of the person -- * Slot: affiliation_ror Description: The ROR of the agent's affiliation. -- * Slot: role Description: The role of the agent relative to the resource +-- # Class: "RepresentationVariant" Description: "A representation of the resource in other media types than text/html which is the default for landing_page_url." +-- * Slot: id Description: +-- * Slot: url Description: The URL of the representation. +-- * Slot: media_type Description: The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml) +-- * Slot: encoding_format Description: The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels +-- * Slot: size Description: The size of the representation in bytes. -- # Class: "Container" Description: "A container for all PID4Cat instances." -- * Slot: id Description: -- # Class: "PID4CatRecord_related_identifiers" Description: "" @@ -45,16 +47,15 @@ -- # Class: "PID4CatRelation_relation_type" Description: "" -- * Slot: PID4CatRelation_id Description: Autocreated FK slot -- * Slot: relation_type Description: Relation type between the resources. +-- # Class: "ResourceInfo_representation_variants" Description: "" +-- * Slot: ResourceInfo_id Description: Autocreated FK slot +-- * Slot: representation_variants_id Description: The representations of the resource in other media types than text/html. CREATE TABLE "ResourceInfo" ( id INTEGER NOT NULL, label TEXT, description TEXT, resource_category VARCHAR(12), - rdf_url TEXT, - rdf_type TEXT, - schema_url TEXT, - schema_type TEXT, PRIMARY KEY (id) ); CREATE TABLE "Agent" ( @@ -66,6 +67,14 @@ CREATE TABLE "Agent" ( role VARCHAR(7), PRIMARY KEY (id) ); +CREATE TABLE "RepresentationVariant" ( + id INTEGER NOT NULL, + url TEXT, + media_type TEXT, + encoding_format TEXT, + size INTEGER, + PRIMARY KEY (id) +); CREATE TABLE "Container" ( id INTEGER NOT NULL, PRIMARY KEY (id) @@ -100,6 +109,13 @@ CREATE TABLE "LogRecord" ( PRIMARY KEY (id), FOREIGN KEY(has_agent_id) REFERENCES "Agent" (id) ); +CREATE TABLE "ResourceInfo_representation_variants" ( + "ResourceInfo_id" INTEGER, + representation_variants_id INTEGER, + PRIMARY KEY ("ResourceInfo_id", representation_variants_id), + FOREIGN KEY("ResourceInfo_id") REFERENCES "ResourceInfo" (id), + FOREIGN KEY(representation_variants_id) REFERENCES "RepresentationVariant" (id) +); CREATE TABLE "PID4CatRecord_related_identifiers" ( "PID4CatRecord_id" TEXT, related_identifiers_id INTEGER, diff --git a/src/pid4cat_model/datamodel/pid4cat_model.py b/src/pid4cat_model/datamodel/pid4cat_model.py index baa035e..50ae45a 100644 --- a/src/pid4cat_model/datamodel/pid4cat_model.py +++ b/src/pid4cat_model/datamodel/pid4cat_model.py @@ -1,5 +1,5 @@ # Auto generated from pid4cat_model.yaml by pythongen.py version: 0.0.1 -# Generation date: 2024-12-05T00:27:05 +# Generation date: 2024-12-05T19:20:02 # Schema: pid4cat-model # # id: https://w3id.org/nfdi4cat/pid4cat-model @@ -23,7 +23,7 @@ from linkml_runtime.utils.enumerations import EnumDefinitionImpl from rdflib import Namespace, URIRef from linkml_runtime.utils.curienamespace import CurieNamespace -from linkml_runtime.linkml_model.types import String, Uriorcurie +from linkml_runtime.linkml_model.types import Integer, String, Uriorcurie from linkml_runtime.utils.metamodelcore import URIorCURIE metamodel_version = "1.7.0" @@ -157,10 +157,7 @@ class ResourceInfo(YAMLRoot): label: Optional[str] = None description: Optional[str] = None resource_category: Optional[Union[str, "ResourceCategory"]] = None - rdf_url: Optional[str] = None - rdf_type: Optional[str] = None - schema_url: Optional[str] = None - schema_type: Optional[str] = None + representation_variants: Optional[Union[Union[dict, "RepresentationVariant"], List[Union[dict, "RepresentationVariant"]]]] = empty_list() def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.label is not None and not isinstance(self.label, str): @@ -172,17 +169,9 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self.resource_category is not None and not isinstance(self.resource_category, ResourceCategory): self.resource_category = ResourceCategory(self.resource_category) - if self.rdf_url is not None and not isinstance(self.rdf_url, str): - self.rdf_url = str(self.rdf_url) - - if self.rdf_type is not None and not isinstance(self.rdf_type, str): - self.rdf_type = str(self.rdf_type) - - if self.schema_url is not None and not isinstance(self.schema_url, str): - self.schema_url = str(self.schema_url) - - if self.schema_type is not None and not isinstance(self.schema_type, str): - self.schema_type = str(self.schema_type) + if not isinstance(self.representation_variants, list): + self.representation_variants = [self.representation_variants] if self.representation_variants is not None else [] + self.representation_variants = [v if isinstance(v, RepresentationVariant) else RepresentationVariant(**as_dict(v)) for v in self.representation_variants] super().__post_init__(**kwargs) @@ -257,6 +246,39 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): super().__post_init__(**kwargs) +@dataclass +class RepresentationVariant(YAMLRoot): + """ + A representation of the resource in other media types than text/html which is the default for landing_page_url. + """ + _inherited_slots: ClassVar[List[str]] = [] + + class_class_uri: ClassVar[URIRef] = PID4CAT_MODEL["RepresentationVariant"] + class_class_curie: ClassVar[str] = "pid4cat_model:RepresentationVariant" + class_name: ClassVar[str] = "RepresentationVariant" + class_model_uri: ClassVar[URIRef] = PID4CAT_MODEL.RepresentationVariant + + url: Optional[str] = None + media_type: Optional[str] = None + encoding_format: Optional[str] = None + size: Optional[int] = None + + def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): + if self.url is not None and not isinstance(self.url, str): + self.url = str(self.url) + + if self.media_type is not None and not isinstance(self.media_type, str): + self.media_type = str(self.media_type) + + if self.encoding_format is not None and not isinstance(self.encoding_format, str): + self.encoding_format = str(self.encoding_format) + + if self.size is not None and not isinstance(self.size, int): + self.size = int(self.size) + + super().__post_init__(**kwargs) + + @dataclass class Container(YAMLRoot): """ @@ -544,17 +566,8 @@ class slots: slots.resource_category = Slot(uri=SCHEMA.additionalType, name="resource_category", curie=SCHEMA.curie('additionalType'), model_uri=PID4CAT_MODEL.resource_category, domain=None, range=Optional[Union[str, "ResourceCategory"]]) -slots.rdf_url = Slot(uri=SCHEMA.additionalType, name="rdf_url", curie=SCHEMA.curie('additionalType'), - model_uri=PID4CAT_MODEL.rdf_url, domain=None, range=Optional[str]) - -slots.rdf_type = Slot(uri=SCHEMA.additionalType, name="rdf_type", curie=SCHEMA.curie('additionalType'), - model_uri=PID4CAT_MODEL.rdf_type, domain=None, range=Optional[str]) - -slots.schema_url = Slot(uri=SCHEMA.additionalType, name="schema_url", curie=SCHEMA.curie('additionalType'), - model_uri=PID4CAT_MODEL.schema_url, domain=None, range=Optional[str]) - -slots.schema_type = Slot(uri=SCHEMA.additionalType, name="schema_type", curie=SCHEMA.curie('additionalType'), - model_uri=PID4CAT_MODEL.schema_type, domain=None, range=Optional[str]) +slots.representation_variants = Slot(uri=PID4CAT_MODEL.representation_variants, name="representation_variants", curie=PID4CAT_MODEL.curie('representation_variants'), + model_uri=PID4CAT_MODEL.representation_variants, domain=None, range=Optional[Union[Union[dict, RepresentationVariant], List[Union[dict, RepresentationVariant]]]]) slots.changed_field = Slot(uri=SCHEMA.identifier, name="changed_field", curie=SCHEMA.curie('identifier'), model_uri=PID4CAT_MODEL.changed_field, domain=None, range=Optional[Union[str, "ChangeLogField"]]) @@ -574,6 +587,18 @@ class slots: slots.role = Slot(uri=SCHEMA.identifier, name="role", curie=SCHEMA.curie('identifier'), model_uri=PID4CAT_MODEL.role, domain=None, range=Optional[Union[str, "PID4CatAgentRole"]]) +slots.media_type = Slot(uri=SCHEMA.encodingFormat, name="media_type", curie=SCHEMA.curie('encodingFormat'), + model_uri=PID4CAT_MODEL.media_type, domain=None, range=Optional[str]) + +slots.encoding_format = Slot(uri=PID4CAT_MODEL.encoding_format, name="encoding_format", curie=PID4CAT_MODEL.curie('encoding_format'), + model_uri=PID4CAT_MODEL.encoding_format, domain=None, range=Optional[str]) + +slots.size = Slot(uri=SCHEMA.fileSize, name="size", curie=SCHEMA.curie('fileSize'), + model_uri=PID4CAT_MODEL.size, domain=None, range=Optional[int]) + +slots.url = Slot(uri=SCHEMA.URL, name="url", curie=SCHEMA.curie('URL'), + model_uri=PID4CAT_MODEL.url, domain=None, range=Optional[str]) + slots.container__contains_pids = Slot(uri=PID4CAT_MODEL.contains_pids, name="container__contains_pids", curie=PID4CAT_MODEL.curie('contains_pids'), model_uri=PID4CAT_MODEL.container__contains_pids, domain=None, range=Optional[Union[Dict[Union[str, PID4CatRecordId], Union[dict, PID4CatRecord]], List[Union[dict, PID4CatRecord]]]]) diff --git a/src/pid4cat_model/datamodel/pid4cat_model_pydantic.py b/src/pid4cat_model/datamodel/pid4cat_model_pydantic.py index d8ccc89..dac1c84 100644 --- a/src/pid4cat_model/datamodel/pid4cat_model_pydantic.py +++ b/src/pid4cat_model/datamodel/pid4cat_model_pydantic.py @@ -34,16 +34,15 @@ version = "None" -class WeakRefShimBaseModel(BaseModel): - __slots__ = '__weakref__' - -class ConfiguredBaseModel(WeakRefShimBaseModel, - validate_assignment = True, - validate_all = True, - underscore_attrs_are_private = True, - extra = "forbid", - arbitrary_types_allowed = True, - use_enum_values = True): +class ConfiguredBaseModel(BaseModel): + model_config = ConfigDict( + validate_assignment = True, + validate_default = True, + extra = "forbid", + arbitrary_types_allowed = True, + use_enum_values = True, + strict = False, + ) pass @@ -193,7 +192,7 @@ class PID4CatRecord(ConfiguredBaseModel): related_identifiers: Optional[List[PID4CatRelation]] = Field(default_factory=list, description="""Relations of the resource to other identifiers.""") change_log: List[LogRecord] = Field(default_factory=list, description="""Change log of PID4Cat record.""") - @validator('curation_contact_email', allow_reuse=True) + @field_validator('curation_contact_email') def pattern_curation_contact_email(cls, v): pattern=re.compile(r"^\S+@[\S+\.]+\S+") if isinstance(v,list): @@ -223,10 +222,7 @@ class ResourceInfo(ConfiguredBaseModel): label: Optional[str] = Field(None, description="""A human-readable name for a resource.""") description: Optional[str] = Field(None, description="""A human-readable description for a resource.""") resource_category: Optional[ResourceCategory] = Field(None, description="""The category of the resource.""") - rdf_url: Optional[str] = Field(None, description="""The URI of the rdf representation of the resource.""") - rdf_type: Optional[str] = Field(None, description="""The format of the rdf representation of the resource (xml, turtle, json-ld, ...).""") - schema_url: Optional[str] = Field(None, description="""The URI of the schema to which the resource conforms. Same property as in DataCite:schemeURI.""") - schema_type: Optional[str] = Field(None, description="""The type of the schema to which the resource conforms. Examples: XSD, DDT, SHACL Same property as in DataCite:schemeType.""") + representation_variants: Optional[List[RepresentationVariant]] = Field(default_factory=list, description="""The representations of the resource in other media types than text/html.""") class LogRecord(ConfiguredBaseModel): @@ -249,7 +245,7 @@ class Agent(ConfiguredBaseModel): affiliation_ror: Optional[str] = Field(None, description="""The ROR of the agent's affiliation.""") role: Optional[PID4CatAgentRole] = Field(None, description="""The role of the agent relative to the resource""") - @validator('email', allow_reuse=True) + @field_validator('email') def pattern_email(cls, v): pattern=re.compile(r"^\S+@[\S+\.]+\S+") if isinstance(v,list): @@ -262,6 +258,16 @@ def pattern_email(cls, v): return v +class RepresentationVariant(ConfiguredBaseModel): + """ + A representation of the resource in other media types than text/html which is the default for landing_page_url. + """ + url: Optional[str] = Field(None, description="""The URL of the representation.""") + media_type: Optional[str] = Field(None, description="""The media type of the representation as defined by [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml)""") + encoding_format: Optional[str] = Field(None, description="""The encoding of the representation. https://encoding.spec.whatwg.org/#names-and-labels""") + size: Optional[int] = Field(None, description="""The size of the representation in bytes.""", ge=0) + + class Container(ConfiguredBaseModel): """ A container for all PID4Cat instances. @@ -269,12 +275,13 @@ class Container(ConfiguredBaseModel): contains_pids: Optional[List[PID4CatRecord]] = Field(default_factory=list, description="""The PID4CatRecords contained in the container.""") -# Update forward refs -# see https://pydantic-docs.helpmanual.io/usage/postponed_annotations/ -PID4CatRecord.update_forward_refs() -PID4CatRelation.update_forward_refs() -ResourceInfo.update_forward_refs() -LogRecord.update_forward_refs() -Agent.update_forward_refs() -Container.update_forward_refs() +# Model rebuild +# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model +PID4CatRecord.model_rebuild() +PID4CatRelation.model_rebuild() +ResourceInfo.model_rebuild() +LogRecord.model_rebuild() +Agent.model_rebuild() +RepresentationVariant.model_rebuild() +Container.model_rebuild()