-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from opendata-swiss/fix/handle-contact-point-…
…without-email Fix/handle contact point without email
- Loading branch information
Showing
4 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,18 @@ | |
"https://example.com/documentation-dataset-1", | ||
"https://example.com/documentation-dataset-2" | ||
], | ||
"contact_points": [ | ||
{ | ||
"name": "Maria Muster", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Maria Muster" | ||
}, | ||
{ | ||
"email": "[email protected]" | ||
} | ||
], | ||
"resources": [ | ||
{ | ||
"id": "e2c50e70-67ad-4f86-bb1b-3f93867eadaa", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
from ckanext.dcat import utils | ||
from ckanext.dcat.processors import RDFSerializer | ||
from ckanext.dcat.profiles import DCAT, DCT, FOAF, OWL, SCHEMA, XSD | ||
from ckanext.dcat.profiles import DCAT, DCT, FOAF, OWL, SCHEMA, VCARD, XSD | ||
|
||
import ckanext.dcatapchharvest.dcat_helpers as dh | ||
|
||
|
@@ -63,6 +63,17 @@ def test_graph_from_dataset(self): | |
for documentation_link in dataset['documentation']: | ||
assert self._triple(g, dataset_ref, FOAF.page, URIRef(documentation_link)) | ||
|
||
# Contact points | ||
eq_(len([t for t in g.triples((dataset_ref, DCAT.contactPoint, None))]), 1) | ||
|
||
contact_point = next(g.objects(dataset_ref, DCAT.contactPoint)) | ||
eq_(next(g.objects(contact_point, RDF.type)), VCARD.Organization) | ||
eq_( | ||
next(g.objects(contact_point, VCARD.hasEmail)), | ||
URIRef("mailto:[email protected]") | ||
) | ||
eq_(next(g.objects(contact_point, VCARD.fn)), Literal("Maria Muster")) | ||
|
||
# Conformance | ||
conforms_to = dataset.get("conforms_to", []) | ||
# Check if the number of triples matches the number of conformance uris | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
from ckanext.dcat import utils | ||
from ckanext.dcat.processors import RDFSerializer | ||
from ckanext.dcat.profiles import SCHEMA | ||
from ckanext.dcat.profiles import SCHEMA, VCARD | ||
|
||
from rdflib import URIRef | ||
import ckanext.dcatapchharvest.dcat_helpers as dh | ||
|
@@ -40,6 +40,17 @@ def test_graph_from_dataset(self): | |
assert self._triple(g, dataset_ref, SCHEMA.version, dataset['version']) | ||
assert self._triple(g, dataset_ref, SCHEMA.identifier, extras['identifier']) | ||
|
||
# Contact points | ||
eq_(len([t for t in g.triples((dataset_ref, SCHEMA.contactPoint, None))]), 1) | ||
|
||
contact_point = next(g.objects(dataset_ref, SCHEMA.contactPoint)) | ||
eq_(next(g.objects(contact_point, RDF.type)), VCARD.Organization) | ||
eq_( | ||
next(g.objects(contact_point, VCARD.hasEmail)), | ||
URIRef("mailto:[email protected]") | ||
) | ||
eq_(next(g.objects(contact_point, VCARD.fn)), Literal("Maria Muster")) | ||
|
||
# Dates | ||
assert self._triple(g, dataset_ref, SCHEMA.datePublished, dataset['issued']) | ||
assert len(list(g.objects(dataset_ref, SCHEMA.dateModified))) == 0 | ||
|