Skip to content

Commit

Permalink
Model: remove redundant info & add enum element
Browse files Browse the repository at this point in the history
Removes has_agent from PID4CatRelation
Adds "LANDING_PAGE" to ChangeLogField enum
  • Loading branch information
dalito committed Dec 9, 2024
1 parent 44442e6 commit aa0ba24
Show file tree
Hide file tree
Showing 16 changed files with 372 additions and 325 deletions.
60 changes: 60 additions & 0 deletions examples/example_p1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"id": "lik-1",
"landing_page_url": "https://pid4cat.example.org/lik-1",
"status": "REGISTERED",
"pid_schema_version": "0.1.0",
"license": "CC0-1.0",
"curation_contact_email": "[email protected]",
"resource_info": {
"label": "Resource label",
"description": "Resource description",
"resource_category": "SAMPLE",
"representation_variants": [
{
"url": "https://example.org/resource",
"media_type": "text/turtle",
"encoding_format": "UTF-8",
"size": 12345
}
]
},
"related_identifiers": [
{
"relation_type": "IS_PART_OF",
"related_identifier": "https://example.org/collection",
"datetime_log": "2024-02-19T00:00:00Z"
},
{
"relation_type": "IS_REFERENCED_BY",
"related_identifier": "https://example.org/referenced",
"datetime_log": "2024-02-19T00:00:00Z"
}
],
"change_log": [
{
"datetime_log": "2024-02-19T00:00:00Z",
"has_agent": {
"name": "Data Fuzzi",
"email": "[email protected]",
"orcid": "0000-0000-0000-0000",
"affiliation_ror": "https://ror.org/01abcde",
"role": "TRUSTEE"
},
"changed_field": "STATUS",
"description": "Registration completed."
},
{
"datetime_log": "2024-05-15T15:51:15Z",
"has_agent": {
"name": "Data Fuzzi",
"email": "[email protected]",
"orcid": "0000-0000-0000-0000",
"affiliation_ror": "https://ror.org/01abcde",
"role": "TRUSTEE"
},
"changed_field": "RESOURCE_INFO",
"description": "as requested in issue #234"
}
],
"@type": "dict"
}
5 changes: 2 additions & 3 deletions examples/example_p1_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
p1_related = [
p4c.PID4CatRelation(
relation_type=p4c.RelationType.IS_PART_OF,
related_identifier="https://example.org/related",
related_identifier="https://example.org/collection",
datetime_log="2024-02-19T00:00:00Z",
has_agent=p1_Agent,
),
p4c.PID4CatRelation(
relation_type=p4c.RelationType.IS_REFERENCED_BY,
related_identifier="https://example.org/referenced",
datetime_log="2024-02-19T00:00:00Z",
has_agent=p1_Agent,
),
]

Expand Down Expand Up @@ -61,6 +59,7 @@
p1 = p4c.PID4CatRecord(
id="lik-1",
landing_page_url="https://pid4cat.example.org/lik-1",
status=p4c.PID4CatStatus.REGISTERED,
pid_schema_version="0.1.0",
license="CC0-1.0",
curation_contact_email="[email protected]",
Expand Down
11 changes: 6 additions & 5 deletions examples/example_p1_pydantic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from linkml_runtime.dumpers import json_dumper, yaml_dumper
from pid4cat_model.datamodel import pid4cat_model_pydantic as p4c

Expand All @@ -14,15 +15,13 @@
p1_related = [
p4c.PID4CatRelation(
relation_type=p4c.RelationType.IS_PART_OF,
related_identifier="https://example.org/related",
related_identifier="https://example.org/collection",
datetime_log="2024-02-19T00:00:00Z",
has_agent=p1_Agent,
),
p4c.PID4CatRelation(
relation_type=p4c.RelationType.IS_REFERENCED_BY,
related_identifier="https://example.org/referenced",
datetime_log="2024-02-19T00:00:00Z",
has_agent=p1_Agent,
),
]

Expand Down Expand Up @@ -76,8 +75,10 @@

print(json_dumper.dumps(p1))

# write to file
with open("example_p1.json", "w", encoding="utf-8") as f:
# write json to file
script_folder = Path(__file__).parent

with open(script_folder / "example_p1.json", "w", encoding="utf-8") as f:
f.write(json_dumper.dumps(p1))

print(yaml_dumper.dumps(c))
Binary file modified project/excel/pid4cat_model.xlsx
Binary file not shown.
1 change: 0 additions & 1 deletion project/graphql/pid4cat_model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type PID4CatRelation
relationType: RelationType
relatedIdentifier: String
datetimeLog: String
hasAgent: Agent
}

type RepresentationVariant
Expand Down
2 changes: 1 addition & 1 deletion 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-09T13:45:36",
"generation_date": "2024-12-09T20:21:31",
"source": "pid4cat_model.yaml"
},
"@context": {
Expand Down
50 changes: 26 additions & 24 deletions project/jsonld/pid4cat_model.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"todos": [
"Refine slots in slot_usage of class instead of globally in slot definitions",
"Check and add mappings to other ontologies. (classes, slots, enums)",
"Add Enums for rdf_type, schema_type"
"Add ranges (types information) to slots"
],
"see_also": [
"https://nfdi4cat.github.io/pid4cat-model"
Expand Down Expand Up @@ -597,6 +597,10 @@
"text": "STATUS",
"description": "The status of the PID4CatRecord was changed."
},
{
"text": "LANDING_PAGE",
"description": "The URL of the landing page in the PID4CatRecord was changed."
},
{
"text": "RESOURCE_INFO",
"description": "The resource info of the PID4CatRecord was changed."
Expand Down Expand Up @@ -813,24 +817,6 @@
"range": "string",
"@type": "SlotDefinition"
},
{
"name": "has_agent",
"definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/has_agent",
"description": "The person who registered the resource.",
"from_schema": "https://w3id.org/nfdi4cat/pid4cat-model",
"mappings": [
"http://schema.org/Agent"
],
"slot_uri": "http://schema.org/Agent",
"owner": "LogRecord",
"domain_of": [
"PID4CatRelation",
"LogRecord"
],
"range": "Agent",
"inlined": true,
"@type": "SlotDefinition"
},
{
"name": "label",
"definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/label",
Expand Down Expand Up @@ -911,6 +897,23 @@
"range": "ChangeLogField",
"@type": "SlotDefinition"
},
{
"name": "has_agent",
"definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/has_agent",
"description": "The person who registered or modified the PID record.",
"from_schema": "https://w3id.org/nfdi4cat/pid4cat-model",
"mappings": [
"http://schema.org/Agent"
],
"slot_uri": "http://schema.org/Agent",
"owner": "LogRecord",
"domain_of": [
"LogRecord"
],
"range": "Agent",
"inlined": true,
"@type": "SlotDefinition"
},
{
"name": "name",
"definition_uri": "https://w3id.org/nfdi4cat/pid4cat-model/name",
Expand Down Expand Up @@ -1143,8 +1146,7 @@
"slots": [
"relation_type",
"related_identifier",
"datetime_log",
"has_agent"
"datetime_log"
],
"slot_usage": {},
"class_uri": "https://w3id.org/nfdi4cat/pid4cat-model/PID4CatRelation",
Expand Down Expand Up @@ -1237,9 +1239,9 @@
],
"metamodel_version": "1.7.0",
"source_file": "pid4cat_model.yaml",
"source_file_date": "2024-12-09T13:45:04",
"source_file_size": 13326,
"generation_date": "2024-12-09T13:45:36",
"source_file_date": "2024-12-09T20:21:12",
"source_file_size": 13430,
"generation_date": "2024-12-09T20:21:31",
"@type": "SchemaDefinition",
"@context": [
"project/jsonld/pid4cat_model.context.jsonld",
Expand Down
7 changes: 2 additions & 5 deletions project/jsonschema/pid4cat_model.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"description": "The field of the PID4Catrecord that was changed.",
"enum": [
"STATUS",
"LANDING_PAGE",
"RESOURCE_INFO",
"RELATED_IDS",
"CONTACT",
Expand Down Expand Up @@ -74,7 +75,7 @@
},
"has_agent": {
"$ref": "#/$defs/Agent",
"description": "The person who registered the resource."
"description": "The person who registered or modified the PID record."
}
},
"title": "LogRecord",
Expand Down Expand Up @@ -152,10 +153,6 @@
"description": "The date and time of a log record.",
"type": "string"
},
"has_agent": {
"$ref": "#/$defs/Agent",
"description": "The person who registered the resource."
},
"related_identifier": {
"description": "Related identifiers for the resource.",
"type": "string"
Expand Down
Loading

0 comments on commit aa0ba24

Please sign in to comment.