Skip to content

Commit

Permalink
chore: add vocabulary check uri by name
Browse files Browse the repository at this point in the history
  • Loading branch information
sarusarah committed Sep 21, 2023
1 parent 7eff937 commit e70e001
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions ckanext/dcatapchharvest/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,19 @@ def graph_from_dataset(self, dataset_dict, dataset_ref): # noqa
g.add((rights_ref, RDF.type, DCT.RightsStatement))
g.add((distribution, DCT.rights, rights_ref))
if rights_uri is None:
resource_rights_ref = URIRef(resource_dict.get('rights'))
g.add((resource_rights_ref, RDF.type, DCT.RightsStatement))
g.add((distribution, DCT.rights, resource_rights_ref))
rights_name = dh.get_license_name_by_uri(
resource_dict.get('rights')
)
if rights_name is not None:
resource_rights_ref = URIRef(
resource_dict.get('rights')
)
g.add((
resource_rights_ref,
RDF.type,
DCT.RightsStatement)
)
g.add((distribution, DCT.rights, resource_rights_ref))

if resource_dict.get('license'):
license_uri = dh.get_license_uri_by_name(
Expand All @@ -817,11 +827,21 @@ def graph_from_dataset(self, dataset_dict, dataset_ref): # noqa
g.add((license_ref, RDF.type, DCT.LicenseDocument))
g.add((distribution, DCT.license, license_ref))
if license_uri is None:
resource_license_ref = URIRef(resource_dict.get('license'))
g.add(
(resource_license_ref, RDF.type, DCT.LicenseDocument)
license_name = dh.get_license_name_by_uri(
resource_dict.get('license')
)
g.add((distribution, DCT.license, resource_license_ref))
if license_name is not None:
resource_license_ref = URIRef(
resource_dict.get('license')
)
g.add((
resource_license_ref,
RDF.type,
DCT.LicenseDocument)
)
g.add(
(distribution, DCT.license, resource_license_ref)
)

self._add_triples_from_dict(resource_dict, distribution, items)
self._add_multilang_value(distribution, DCT.title, 'display_name', resource_dict) # noqa
Expand Down

0 comments on commit e70e001

Please sign in to comment.