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

Use rdf_value and replace mailto prefix #2943

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Current (in progress)

- Improve search serialization perfs for datasets in big topics [#2937](https://github.com/opendatateam/udata/pull/2937)
- Contact points feature [#2914](https://github.com/opendatateam/udata/pull/2914):
- Contact points feature [#2914](https://github.com/opendatateam/udata/pull/2914) [#2943](https://github.com/opendatateam/udata/pull/2943):
- Users and Organizations can now define a list of contact points
- Api endpoint for creating, updating and deleting contact points
- Datasets can define one contact point, among the list of the organization or the user owning the dataset.
Expand Down
11 changes: 7 additions & 4 deletions udata/core/dataset/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,13 @@ def temporal_from_rdf(period_of_time):
def contact_point_from_rdf(rdf, dataset):
contact_point = rdf.value(DCAT.contactPoint)
if contact_point:
name = contact_point.value(VCARD.fn)
email = (contact_point.value(VCARD.hasEmail)
or contact_point.value(VCARD.email)
or contact_point.value(DCAT.email))
name = rdf_value(contact_point, VCARD.fn) or ''
email = (rdf_value(contact_point, VCARD.hasEmail)
or rdf_value(contact_point, VCARD.email)
or rdf_value(contact_point, DCAT.email))
if not email:
return
email = email.replace('mailto:', '').strip()
if dataset.organization:
contact_point = ContactPoint.objects(
name=name, email=email, organization=dataset.organization).first()
Expand Down
2 changes: 1 addition & 1 deletion udata/harvest/tests/dcat/catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
</dcat:Distribution>
<vcard:Organization rdf:about="http://data.test.org/contacts/1">
<vcard:fn>Organization contact</vcard:fn>
<vcard:hasEmail>hello@its.me</vcard:hasEmail>
<vcard:hasEmail>mailto: hello@its.me</vcard:hasEmail>
</vcard:Organization>
<dcterms:PeriodOfTime rdf:about="file:///base/data/home/apps/s%7Erdf-translator/2.408516547054015808/temporal-2">
<schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-01-01T00:00:00</schema:startDate>
Expand Down