diff --git a/tests/trove/derive/test_osfmap_json_mini.py b/tests/trove/derive/test_osfmap_json_mini.py index 7c7da6a5d..aa54e44ab 100644 --- a/tests/trove/derive/test_osfmap_json_mini.py +++ b/tests/trove/derive/test_osfmap_json_mini.py @@ -154,6 +154,12 @@ class TestOsfmapJsonMiniDeriver(BaseIndexcardDeriverTest): }, 'osfmap-registration': { "@id": "https://osf.example/2c4st", + "accessService": [{ + "@id": "https://osf.example", + "identifier": [{"@value": "https://osf.example"}], + "name": [{"@value": "OSF"}], + "resourceType": [{"@id": "Agent"}, {"@id": "Organization"}], + }], "resourceType": [ {"@id": "Registration"} ], @@ -455,6 +461,10 @@ class TestOsfmapJsonMiniDeriver(BaseIndexcardDeriverTest): ] } ], + "qualifiedAttribution": [{ + "agent": [{"@id": "https://osf.example/bhcjn"}], + "hadRole": [{"@id": "osf:admin-contributor"}], + }], "archivedAt": [ {"@id": "https://archive.example/details/osf-registrations-2c4st-v1"} ], diff --git a/trove/derive/osfmap_json_mini.py b/trove/derive/osfmap_json_mini.py index c4da33e08..cd4520f62 100644 --- a/trove/derive/osfmap_json_mini.py +++ b/trove/derive/osfmap_json_mini.py @@ -2,36 +2,8 @@ from trove.derive.osfmap_json import OsfmapJsonFullDeriver from trove.vocab.namespaces import TROVE -INCLUDED_PREDICATE_SET = frozenset({ - ns.RDF.type, - ns.DCTERMS.title, - ns.DCTERMS.creator, - ns.DCTERMS.date, - ns.DCTERMS.created, - ns.FOAF.name, - ns.OWL.sameAs, - ns.DCTERMS.conformsTo, - ns.DCTERMS.dateCopyrighted, - ns.DCTERMS.description, - ns.DCTERMS.hasPart, - ns.DCTERMS.isVersionOf, - ns.DCTERMS.modified, - ns.DCTERMS.publisher, - ns.DCTERMS.rights, - ns.DCTERMS.subject, - ns.DCTERMS.isPartOf, - ns.DCTERMS.identifier, - ns.SKOS.inScheme, - ns.SKOS.prefLabel, - ns.OSFMAP.affiliation, - ns.OSFMAP.archivedAt, - ns.DCTERMS.dateAccepted, - ns.DCTERMS.dateModified, - ns.OSFMAP.hostingInstitution, - ns.OSFMAP.keyword, - ns.OSFMAP.fileName, - ns.OSFMAP.filePath, - ns.OSFMAP.isContainedBy +EXCLUDED_PREDICATE_SET = frozenset({ + ns.OSFMAP.contains, }) @@ -57,4 +29,4 @@ def convert_tripledict(self): @staticmethod def _should_keep_predicate(predicate: str) -> bool: - return predicate in INCLUDED_PREDICATE_SET + return predicate not in EXCLUDED_PREDICATE_SET diff --git a/trove/util/trove_params.py b/trove/util/trove_params.py index 920960679..c693de112 100644 --- a/trove/util/trove_params.py +++ b/trove/util/trove_params.py @@ -100,26 +100,19 @@ def _gather_attrpaths(cls, queryparams: _qp.QueryparamDict, shorthand: rdf.IriSh if _fields_params: _requested: dict[str, list[Propertypath]] = defaultdict(list) for _param_name, _param_value in _fields_params: - try: - (_typenames,) = filter(bool, _param_name.bracketed_names) - except (IndexError, ValueError): - raise trove_exceptions.InvalidQueryParamName( - f'expected "fields[TYPE]" (with exactly one non-empty bracketed segment)' - f' (got "{_param_name}")' - ) - else: - for _type in _qp.split_queryparam_value(_typenames): - _type_key = ( - GLOB_PATHSTEP - if _type == GLOB_PATHSTEP - else shorthand.expand_iri(_type) - ) - _requested[_type_key].extend( - ( - parse_propertypath(_path_value, shorthand) - for _path_value in _qp.split_queryparam_value(_param_value) - ) + if _param_name.bracketed_names: # e.g. "fields[TYPE1,TYPE2,TYPE3]=..." + _typenames = _qp.split_queryparam_value(_param_name.bracketed_names[0]) + else: # omitted brackets equivalent to "fields[*]" (apply to any type) + _typenames = [GLOB_PATHSTEP] + for _typename in _typenames: + if _typename != GLOB_PATHSTEP: + _typename = shorthand.expand_iri(_typename) + _requested[_typename].extend( + ( # list of field paths in query param value + parse_propertypath(_path_value, shorthand) + for _path_value in _qp.split_queryparam_value(_param_value) ) + ) _attrpaths = _attrpaths.with_new(freeze(_requested)) return _attrpaths diff --git a/trove/vocab/osfmap.py b/trove/vocab/osfmap.py index 731834ade..d67e545e8 100644 --- a/trove/vocab/osfmap.py +++ b/trove/vocab/osfmap.py @@ -356,13 +356,13 @@ literal('isSupplementedBy', language='en'), }, }, - OSFMAP.verifiedLinks: { + OSFMAP.verifiedLink: { RDF.type: {RDF.Property}, RDFS.label: { literal('Verified Links', language='en'), }, JSONAPI_MEMBERNAME: { - literal('verifiedLinks', language='en'), + literal('verifiedLink', language='en'), }, }, OSFMAP.archivedAt: { @@ -572,10 +572,10 @@ literal('accessService', language='en'), }, }, - DCAT.accessUrl: { + DCAT.accessURL: { RDF.type: {RDF.Property}, JSONAPI_MEMBERNAME: { - literal('accessUrl', language='en'), + literal('accessURL', language='en'), }, }, OSFMAP.hostingInstitution: {