-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pydantic model gen; improve schema
Schema - add slot: pid_schema_version - fix: Make ResourceInfo single-valued - style: Gave enums singular name
- Loading branch information
Showing
20 changed files
with
1,193 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from linkml_runtime.dumpers import json_dumper, yaml_dumper | ||
from pid4cat_model.datamodel import pid4cat_model_pydantic as p4c | ||
|
||
p1_Agent = p4c.Agent( | ||
name="Data Fuzzi", | ||
contact_information=None, | ||
person_orcid="0000-0000-0000-0000", | ||
affiliation_ror=None, | ||
role=p4c.PID4CatAgentRole.TRUSTEE, | ||
) | ||
|
||
p1_log = p4c.LogRecord( | ||
datetime_log="2024-02-19T00:00:00Z", | ||
has_agent=p1_Agent, | ||
changed_field=p4c.ChangeLogField.STATUS, | ||
description="as requested in issue #123", | ||
) | ||
|
||
p1_ressource_info = p4c.ResourceInfo( | ||
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", | ||
) | ||
|
||
p1 = p4c.PID4CatRecord( | ||
id="lik-123", | ||
change_log=[p1_log], | ||
landing_page_url="https://pid4cat.example.org/lik-123", | ||
status=p4c.PID4CatStatus.REGISTERED, | ||
pid_schema_version="0.1.0", | ||
record_version="20240219v-0", | ||
resource_info=p1_ressource_info, | ||
related_identifiers=None, | ||
dc_rights="CC0-1.0", | ||
curation_contact="[email protected]", | ||
) | ||
|
||
c = p4c.Container(contains_pids=[p1]) | ||
|
||
print(p1) | ||
|
||
print(json_dumper.dumps(p1)) | ||
|
||
print(yaml_dumper.dumps(c)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from linkml_runtime.dumpers import json_dumper | ||
from pid4cat_model.datamodel import pid4cat_model as p4c | ||
|
||
|
||
p1_Agent = p4c.Agent( | ||
person_orcid="0000-0000-0000-0000", | ||
name="Data Fuzzi", | ||
role="TRUSTEE", | ||
) | ||
|
||
p1_log = p4c.LogRecord( | ||
datetime_log="2024-02-19T00:00:00Z", | ||
has_agent=p1_Agent, | ||
changed_field=p4c.ChangeLogField.STATUS, # "STATUS", | ||
description="as requested in issue #123", | ||
) | ||
|
||
p1 = p4c.PID4CatRecord( | ||
id="lik-1", | ||
change_log=p1_log, | ||
landing_page_url="https://pid4cat.example.org/lik-1", | ||
status=p4c.PID4CatStatus.REGISTERED, # "REGISTERED", | ||
record_version="20240219v-0", | ||
resource_info={}, | ||
related_identifiers=None, | ||
dc_rights="CC0-1.0", | ||
curation_contact="[email protected]", | ||
) | ||
|
||
print(p1) | ||
|
||
print(json_dumper.dumps(p1)) | ||
|
||
c = p4c.Container(contains_pids=[p1]) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.