在CKAN中添加数据有三个选项'链接到文件','链接到API','上传文件'。这两个选项'链接到文件'和'链接到API'有什么区别?
答案 0 :(得分:3)
'链接到文件'用于链接到实际数据文件的URL,例如,一个CSV文件。 “链接到API”旨在用于链接到网页,人们可以在其中阅读可供他们使用的某些数据API。
如果您提供指向实际文件的链接,例如一个CSV文件,然后CKAN的datastorer或datapusher可以将该文件中的数据提取到CKAN的DataStore,然后DataStore的Data API将可用于该文件和数据预览将起作用,就像您已将文件直接上传到CKAN一样。即使您没有DataStore或datastorer / datapusher,CKAN仍然可以使用其DataProxy显示该文件的预览。
另一方面,如果链接到API,则所有用户都可以按照链接进行操作。
答案 1 :(得分:2)
这是元数据,它有助于数据的使用者理解如何解释此链接。文件通常是一组有限的数据,您可以下载。如果API根据请求提供数据,则每种API的格式和语法可能会有很大差异。
对于CKAN本身而言,它与文件或API的链接并不重要。正如您在下面的示例中所看到的,API和文件的下载链接是不同的。 CKAN API的结果显示不同的resource_type
(api
与file.upload
}:
<强> API:强>
{
resource_group_id: "904ef692-6172-4173-92ec-3363aefcd599",
cache_last_updated: null,
revision_timestamp: "2012-09-25T14:38:05.040756",
webstore_last_updated: null,
id: "9060cf57-a1b1-4d32-8411-6ebfe6f8923b",
size: null,
state: "active",
hash: "",
description: "If called without any parameter, the API returns all markers in Geo-JSON format. This call can be demanding on the server so try not to do this call more than once. If you want to build your own services on the Vici.org data, please use the following call: http://vici.org/points.php?bounds=38.0,-7.0,40.0,-5.0&zoom=11 This call only return the markers for the area defined by two corners of 'bounds' (latitude, longitude of south-west point, latitude, longitude of north-east point). The higher the value of 'zoom', the more 'detail' markers are returned.",
format: "JSON",
tracking_summary: {
total: 0,
recent: 0
},
mimetype_inner: "",
mimetype: "application/json",
cache_url: "",
name: "Search API",
created: "2012-09-25T09:35:54.519845",
url: "http://vici.org/points.php",
webstore_url: "",
last_modified: "2012-09-25T09:35:56.933638",
position: 0,
revision_id: "92cc4b1c-bc1f-4fc4-8d45-54f342b7d617",
resource_type: "api"
}
文件:强>
File (Wikipedia new user registration):
{
resource_group_id: "59423860-c694-413f-bd8c-53e4aba75d38",
cache_last_updated: null,
revision_timestamp: "2012-05-09T21:56:11.096290",
webstore_last_updated: null,
owner: "c349ab48-4ac5-482d-bd5c-d3c7501e65aa",
id: "0064af74-6877-4105-9098-5ccbddf68d33",
size: "312354",
cache_url_updated: "2012-05-09T21:51:12",
state: "active",
hash: "bb462573a0f0ef328dd989b9c0ee0c9072b18f87",
description: "Hourly new user registrations to the English Wikipedia (2008-2011), timestamps are aligned to 2011 for easy year-to-year comparison.",
format: "CSV",
tracking_summary: {
total: 0,
recent: 0
},
mimetype_inner: "",
mimetype: "text/csv",
cache_url: "",
name: "enwiki-hourly-registrations-2008-2011.csv",
created: "2012-05-09T21:53:23.820579",
url: "https://commondatastorage.googleapis.com/ckannet-storage/2012-05-09T215108/enwiki-hourly-registrations-2008-2011.csv",
webstore_url: "https://commondatastorage.googleapis.com/ckannet-storage/2012-05-09T215108/enwiki-hourly-registrations-2008-2011.csv",
last_modified: "2012-05-09T21:53:24.900960",
position: 0,
revision_id: "f777dc04-a041-436d-83dd-2f03df4c8e15",
resource_type: "file.upload"
}