2

在 CKAN 中添加数据有三个选项“链接到文件”、“链接到 API”、“上传文件”。这两个选项“链接到文件”和“链接到 API”有什么区别?

4

2 回答 2

3

“链接到文件”旨在用于链接到实际数据文件的 URL,例如 CSV 文件。“链接到 API”旨在用于链接到人们可以阅读有关他们可用的某些数据 API 的网页。

如果您提供一个指向实际文件的链接,例如 CSV 文件,那么 CKAN 的datastorerdatapusher可以将该文件中的数据拉取到 CKAN 的DataStore中,然后 DataStore 的Data API将可用于该文件,并且数据预览将起作用,就像您将文件直接上传到 CKAN 一样。即使您没有 DataStore 或 datastorer/datapusher,CKAN 仍然可以使用其 DataProxy 显示文件的预览。

另一方面,如果您链​​接到 API,则所有用户都可以点击链接。

于 2013-12-12T09:30:14.333 回答
2

这是元数据,它帮助数据的消费者理解如何解释这个链接。文件通常是一组有限的数据,您可以下载。如果 API 根据请求提供数据,则每个 API 的格式和语法可能非常不同。

对于 CKAN 本身,它是指向文件或 API 的链接并不重要。正如您在下面的示例中所见,API 和文件的下载链接不同。CKAN API的结果显示了不同的resource_typeapivs. file.upload):

接口: API端点

API(Vici.org 搜索 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"
}

文件: 下载和预览文件

文件(维基百科新用户注册)

{
    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"
}
于 2013-12-12T10:39:22.060 回答