udata 10.2.0__py2.py3-none-any.whl → 10.2.1.dev34693__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

Files changed (26) hide show
  1. udata/__init__.py +1 -1
  2. udata/core/dataset/rdf.py +4 -0
  3. udata/harvest/tests/dcat/catalog.xml +15 -2
  4. udata/harvest/tests/test_dcat_backend.py +21 -2
  5. udata/static/chunks/{10.8ca60413647062717b1e.js → 10.471164b2a9fe15614797.js} +3 -3
  6. udata/static/chunks/{10.8ca60413647062717b1e.js.map → 10.471164b2a9fe15614797.js.map} +1 -1
  7. udata/static/chunks/{11.b6f741fcc366abfad9c4.js → 11.51d706fb9521c16976bc.js} +3 -3
  8. udata/static/chunks/{11.b6f741fcc366abfad9c4.js.map → 11.51d706fb9521c16976bc.js.map} +1 -1
  9. udata/static/chunks/{13.2d06442dd9a05d9777b5.js → 13.f29411b06be1883356a3.js} +2 -2
  10. udata/static/chunks/{13.2d06442dd9a05d9777b5.js.map → 13.f29411b06be1883356a3.js.map} +1 -1
  11. udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js → 17.3bd0340930d4a314ce9c.js} +2 -2
  12. udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js.map → 17.3bd0340930d4a314ce9c.js.map} +1 -1
  13. udata/static/chunks/{19.f03a102365af4315f9db.js → 19.8da42e8359d72afc2618.js} +3 -3
  14. udata/static/chunks/{19.f03a102365af4315f9db.js.map → 19.8da42e8359d72afc2618.js.map} +1 -1
  15. udata/static/chunks/{8.778091d55cd8ea39af6b.js → 8.54e44b102164ae5e7a67.js} +2 -2
  16. udata/static/chunks/{8.778091d55cd8ea39af6b.js.map → 8.54e44b102164ae5e7a67.js.map} +1 -1
  17. udata/static/chunks/{9.033d7e190ca9e226a5d0.js → 9.07515e5187f475bce828.js} +3 -3
  18. udata/static/chunks/{9.033d7e190ca9e226a5d0.js.map → 9.07515e5187f475bce828.js.map} +1 -1
  19. udata/static/common.js +1 -1
  20. udata/static/common.js.map +1 -1
  21. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/METADATA +5 -1
  22. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/RECORD +26 -26
  23. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/LICENSE +0 -0
  24. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/WHEEL +0 -0
  25. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/entry_points.txt +0 -0
  26. {udata-10.2.0.dist-info → udata-10.2.1.dev34693.dist-info}/top_level.txt +0 -0
udata/__init__.py CHANGED
@@ -4,5 +4,5 @@
4
4
  udata
5
5
  """
6
6
 
7
- __version__ = "10.2.0"
7
+ __version__ = "10.2.1.dev"
8
8
  __description__ = "Open data portal"
udata/core/dataset/rdf.py CHANGED
@@ -722,6 +722,10 @@ def resource_from_rdf(graph_or_distrib, dataset=None, is_additionnal=False):
722
722
  resource.checksum.type = algorithm
723
723
  if is_additionnal:
724
724
  resource.type = "other"
725
+ elif distrib.value(DCAT.accessService):
726
+ # The distribution has a DCAT.accessService property, we deduce
727
+ # that the distribution is of type API
728
+ resource.type = "api"
725
729
 
726
730
  identifier = rdf_value(distrib, DCT.identifier)
727
731
  uri = distrib.identifier.toPython() if isinstance(distrib.identifier, URIRef) else None
@@ -61,16 +61,17 @@
61
61
  <dcat:theme>Theme 1</dcat:theme>
62
62
  <dcterms:publisher rdf:resource="http://data.test.org/organizations/1"/>
63
63
  <owl:versionInfo>1.0</owl:versionInfo>
64
- <dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/2"/>
65
64
  <dcat:keyword>Tag 4</dcat:keyword>
66
65
  <dcterms:spatial rdf:resource="http://wuEurope.com/"/>
67
66
  <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-12-14T19:01:24.184120</dcterms:modified>
68
67
  <dcat:keyword>Tag 2</dcat:keyword>
69
68
  <dcat:keyword>Tag 1</dcat:keyword>
70
- <dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/1"/>
71
69
  <dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-12-14T18:59:02.737480</dcterms:issued>
72
70
  <dcterms:identifier>1</dcterms:identifier>
71
+ <dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/1"/>
72
+ <dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/2"/>
73
73
  <dcterms:hasPart rdf:resource="http://data.test.org/datasets/1/resources/3"/>
74
+ <dcat:distribution rdf:resource="http://data.test.org/datasets/1/resources/4"/>
74
75
  </dcat:Dataset>
75
76
  </dcat:dataset>
76
77
  <dcat:dataset>
@@ -152,6 +153,18 @@
152
153
  <dcterms:title>Resource 1-3</dcterms:title>
153
154
  <dcterms:format>JSON</dcterms:format>
154
155
  </foaf:Document>
156
+ <dcat:Distribution rdf:about="http://data.test.org/datasets/1/resources/4">
157
+ <dcterms:description>A resource pointing towards a Geo Service</dcterms:description>
158
+ <dcterms:title>Resource 1-4</dcterms:title>
159
+ <dcat:accessURL>http://data.test.org/datasets/1/resources/4/services?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0</dcat:accessURL>
160
+ <dcat:accessService>
161
+ <dcat:DataService>
162
+ <dcterms:title xml:lang="fr">Geo Service</dcterms:title>
163
+ <dcat:endpointURL rdf:resource="http://data.test.org/datasets/1/resources/4/services"/>
164
+ <dcat:endpointDescription rdf:resource="http://data.test.org/datasets/1/resources/4/services?SERVICE=WMS&amp;REQUEST=GetCapabilities&amp;VERSION=1.3.0"/>
165
+ </dcat:DataService>
166
+ </dcat:accessService>
167
+ </dcat:Distribution>
155
168
  <!-- resources for dataset 2 -->
156
169
  <dcat:Distribution rdf:about="http://data.test.org/datasets/2/resources/1">
157
170
  <dcat:accessURL>http://data.test.org/datasets/2/resources/1/file.json</dcat:accessURL>
@@ -137,6 +137,7 @@ class DcatBackendTest:
137
137
  assert datasets["1"].resources[0].description == "A JSON resource"
138
138
  assert datasets["1"].resources[0].format == "json"
139
139
  assert datasets["1"].resources[0].mime == "application/json"
140
+ assert datasets["1"].resources[0].type == "main"
140
141
 
141
142
  @pytest.mark.options(
142
143
  SCHEMA_CATALOG_URL="https://example.com/schemas",
@@ -403,6 +404,7 @@ class DcatBackendTest:
403
404
  assert len(dataset.resources) == 1
404
405
 
405
406
  resource = dataset.resources[0]
407
+ assert resource.type == "main"
406
408
  assert resource.checksum is not None
407
409
  assert resource.checksum.type == "sha1"
408
410
  assert resource.checksum.value == "fb4106aa286a53be44ec99515f0f0421d4d7ad7d"
@@ -476,7 +478,12 @@ class DcatBackendTest:
476
478
 
477
479
  assert job.status == "done"
478
480
  assert job.errors == []
479
- assert len(job.items) == 4
481
+ assert len(job.items) == 5
482
+ # 4 datasets and one Dataservice mentionned but not described
483
+ # because it appears in a distribution as DCAT.accessService
484
+ # but is missing a proper DCT.identifier
485
+ assert len([item for item in job.items if item.status == "done"]) == 4
486
+ assert len([item for item in job.items if item.status == "skipped"]) == 1
480
487
 
481
488
  def test_xml_catalog(self, rmock):
482
489
  LicenseFactory(id="lov2", title="Licence Ouverte Version 2.0")
@@ -524,7 +531,7 @@ class DcatBackendTest:
524
531
  # test dct:license nested in distribution
525
532
  assert dataset.license.id == "lov1"
526
533
 
527
- assert len(dataset.resources) == 3
534
+ assert len(dataset.resources) == 4
528
535
 
529
536
  resource_1 = next(res for res in dataset.resources if res.title == "Resource 1-1")
530
537
  assert resource_1.filetype == "remote"
@@ -549,6 +556,16 @@ class DcatBackendTest:
549
556
  assert resource_3.url == "http://data.test.org/datasets/1/resources/3"
550
557
  assert resource_3.type == "other"
551
558
 
559
+ # Make sure a resource with an accessService is of type api
560
+ resource_4 = next(res for res in dataset.resources if res.title == "Resource 1-4")
561
+ assert resource_4.format is None
562
+ assert resource_4.description == "A resource pointing towards a Geo Service"
563
+ assert (
564
+ resource_4.url
565
+ == "http://data.test.org/datasets/1/resources/4/services?SERVICE=WMS&REQUEST=GetCapabilities&VERSION=1.3.0"
566
+ )
567
+ assert resource_4.type == "api"
568
+
552
569
  # test dct:rights -> license support from dataset
553
570
  dataset = Dataset.objects.get(harvest__dct_identifier="2")
554
571
  assert dataset.license.id == "lov2"
@@ -838,6 +855,7 @@ class CswDcatBackendTest:
838
855
  assert resource.title == "accidento_hdf_L93"
839
856
  assert resource.url == "https://www.geo2france.fr/geoserver/cr_hdf/ows"
840
857
  assert resource.format == "ogc:wms"
858
+ assert resource.type == "main"
841
859
 
842
860
  def test_user_agent_post(self, rmock):
843
861
  url = mock_csw_pagination(rmock, "geonetwork/srv/eng/csw.rdf", "geonetworkv4-page-{}.xml")
@@ -949,6 +967,7 @@ class CswIso19139DcatBackendTest:
949
967
  resource.url
950
968
  == "http://atom.geo-ide.developpement-durable.gouv.fr/atomArchive/GetResource?id=fr-120066022-ldd-cab63273-b3ae-4e8a-ae1c-6192e45faa94&datasetAggregate=true"
951
969
  )
970
+ assert resource.type == "main"
952
971
 
953
972
  # Sadly resource format is parsed as a blank node. Format parsing should be improved.
954
973
  assert re.match(r"n[0-9a-f]{32}", resource.format)