Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource type #231

Closed
bendichter opened this issue Mar 16, 2024 · 2 comments · Fixed by #232
Closed

Resource type #231

bendichter opened this issue Mar 16, 2024 · 2 comments · Fixed by #232

Comments

@bendichter
Copy link
Member

class Resource(DandiBaseModel):
identifier: Optional[Identifier] = Field(
None, json_schema_extra={"nskey": "schema"}
)
name: Optional[str] = Field(
None, title="A title of the resource", json_schema_extra={"nskey": "schema"}
)
url: Optional[AnyHttpUrl] = Field(
None, title="URL of the resource", json_schema_extra={"nskey": "schema"}
)
repository: Optional[str] = Field(
None,
title="Name of the repository",
description="Name of the repository in which the resource is housed.",
json_schema_extra={"nskey": "dandi"},
)
relation: RelationType = Field(
title="Resource relation",
description="Indicates how the resource is related to the dataset. "
"This relation should satisfy: dandiset <relation> resource.",
json_schema_extra={"nskey": "dandi"},
)
schemaKey: Literal["Resource"] = Field(
"Resource", validate_default=True, json_schema_extra={"readOnly": True}
)
_ldmeta = {
"rdfs:subClassOf": ["schema:CreativeWork", "prov:Entity"],
"rdfs:comment": "A resource related to the project (e.g., another "
"dataset, publication, Webpage)",
"nskey": "dandi",
}

Our current resource schema has no way of indicating what type of resource it is. This is currently a problem for me as I am trying to determine how many unique publications are associated with the data on DANDI. I need to infer the type based on the designated relation and the URL. It would be much easier for me if this infrormation were explicitly encoded. The Data Cite schema provides a resourceType model that covers a lot of major resource categories. I propose we add this as an optional field to the Resource model.

@satra
Copy link
Member

satra commented Mar 16, 2024

sounds good. any interest in sending a PR to add an attribute and a set of elements (see the other type enums on how that's done)?

@bendichter
Copy link
Member Author

It works!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants