-
Notifications
You must be signed in to change notification settings - Fork 356
[ENG-10234] 1.1.6 BE: Implement mapping to convert from DataCite resource types to schema.org resource types #11586
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
base: feature/fair-signposting
Are you sure you want to change the base?
Conversation
…eed tests updates and maybe some type yield logic )
aaxelb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! two suggestions
osf/metadata/serializers/linkset.py
Outdated
| yield SignpostLink(focus_iri, 'type', f'https://schema.org/{schema_type}') | ||
| yield SignpostLink(focus_iri, 'type', 'https://schema.org/AboutPage') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're using it this much, may as well add a namespace to osf.metadata.rdfutils like SDO = rdflib.Namespace('https://schema.org/')
and replace all the hard-coded "https://sche.../foo"" with SDO.foo
osf/metadata/rdfutils.py
Outdated
| } | ||
|
|
||
|
|
||
| RESOURCE_SCHEMA_RESOURCE_TYPE_GENERAL_MAPPING = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like these two mappings could be combined into one (their keys won't collide, thanks iri namespaces)
then could skip the branch on _type_iri.startswith(DATACITE), handle all the same way
osf/metadata/rdfutils.py
Outdated
| ) | ||
|
|
||
| def map_resource_type_general_datacite_to_scheme(_type_iri: rdflib.URIRef, resource_rdftype: rdflib.URIRef) -> str: | ||
| return DATACITE_SCHEMA_RESOURCE_TYPE_GENERAL_MAPPING.get(_type_iri) or DATACITE_SCHEMA_RESOURCE_TYPE_GENERAL_MAPPING.get(resource_rdftype, 'Text') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the default value to a constant (and make it a full iri to match my other suggestion)
DEFAULT_SCHEMADOTORG_RESOURCE_TYPE = SCHEMA.CreativeWork(CreativeWork seems a more sensical default than Text, but either way, as long as it's clearly defined in one place)
osf/metadata/rdfutils.py
Outdated
|
|
||
|
|
||
| DATACITE_SCHEMA_RESOURCE_TYPE_GENERAL_MAPPING = { | ||
| DATACITE.Audiovisual: 'MediaObject', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may as well use the namespace you added, then can avoid all the manual f"https://schema.org/{...}"
DATACITE.Audiovisual: SCHEMA.MediaObject,
...
Ticket
Purpose
We currently use DataCite URI/terminology to refer to an object’s type (e.g. AudioVisual, Book, BookChapter, etc). FAIR Signposting expects these object types to be represented using schema.org terms/URIs. We will need to a mapping to convert between DataCite and schema.org when we get the linkset doc for a given object.
For projects, registrations, and preprints, if a user has specified a resourceType using the DataCite resource type terminology (AudioVisual, Book, BookChapter), then we should use that and map it to an appropriate schema.org URI. Otherwise, we should just the OSF object type (Project, Registration, Preprint) and map that to an appropriate schema.org URI. Projects, registrations, and preprints should have a second type link: “Provide a second link that has as target https://schema.org/AboutPage in the common case where an actual landing page is concerned” from FAIR Signposting Profile - Signposting the Scholarly Web
Changes
Implementing mapping for datacite to scheme
(created from the following one linkset related PR #11571 to keep its changings )
Side Effects
QE Notes
CE Notes
Documentation