Skip to content

Commit

Permalink
Update examples & generated files after schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
dalito committed Dec 5, 2024
1 parent feb1341 commit e57aa8d
Show file tree
Hide file tree
Showing 16 changed files with 563 additions and 389 deletions.
12 changes: 8 additions & 4 deletions example_resource_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Empty file added examples/output/README.md
Empty file.
12 changes: 8 additions & 4 deletions explore_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 15 additions & 1 deletion explore_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
Expand Down
Binary file modified project/excel/pid4cat_model.xlsx
Binary file not shown.
13 changes: 9 additions & 4 deletions project/graphql/pid4cat_model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}

32 changes: 20 additions & 12 deletions project/jsonld/pid4cat_model.context.jsonld
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -45,6 +45,9 @@
"email": {
"@id": "schema:email"
},
"encoding_format": {
"@id": "encoding_format"
},
"has_agent": {
"@type": "@id",
"@id": "schema:Agent"
Expand All @@ -59,6 +62,9 @@
"license": {
"@id": "schema:license"
},
"media_type": {
"@id": "schema:encodingFormat"
},
"name": {
"@id": "schema:name"
},
Expand All @@ -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"
},
Expand All @@ -90,6 +90,10 @@
},
"@id": "schema:identifier"
},
"representation_variants": {
"@type": "@id",
"@id": "representation_variants"
},
"resource_category": {
"@context": {
"@vocab": "@null",
Expand All @@ -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": {
Expand All @@ -127,6 +129,9 @@
},
"@id": "status"
},
"url": {
"@id": "schema:URL"
},
"Agent": {
"@id": "Agent"
},
Expand All @@ -142,6 +147,9 @@
"PID4CatRelation": {
"@id": "PID4CatRelation"
},
"RepresentationVariant": {
"@id": "RepresentationVariant"
},
"ResourceInfo": {
"@id": "ResourceInfo"
}
Expand Down
151 changes: 88 additions & 63 deletions project/jsonld/pid4cat_model.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Loading

0 comments on commit e57aa8d

Please sign in to comment.