Skip to content

Latest commit

 

History

History
378 lines (321 loc) · 13.9 KB

File metadata and controls

378 lines (321 loc) · 13.9 KB

Smart Data Models

实体表模式无摩擦数据

开放许可

文件自动生成

全局描述:该资源的表模式,符合表模式规范。为智能数据模型计划从原始无摩擦数据转换而来

版本: 0.0.2

属性列表

[*] 如果属性中没有类型,是因为它可能有多个类型或不同的格式/模式

  • alternateName[string]: 该项目的替代名称
  • dataProvider[string]: 标识统一数据实体提供者的字符序列
  • dateCreated[date-time]: 实体创建时间戳。通常由存储平台分配
  • dateModified[date-time]: 实体最后一次修改的时间戳。通常由存储平台分配
  • description[string]: 项目描述
  • fields[array]: 表模式字段对象数组
  • foreignKeys[array]:
  • id[*]: 实体的唯一标识符
  • missingValues[array]: 许多数据集都会出现数据值缺失的情况,这可能是因为某个值没有被收集到或者从未存在过。在其他情况下,可能使用了特殊的值,如"-"、"NaN"、"0"、"-9999 "等。"missageValues "属性提供了一种方法来表示这些值应被解释为等同于空值。missingValues' 是字符串,而不是特定字段的数据类型。这样就可以在赋值前进行比较,并使字段的缺失值与其类型不符,例如 "数字 "字段的缺失值用"-"表示。对于字符串类型字段,"missingValue "没有默认值(对于字符串字段,空字符串"''是一个有效值,不必表示空)。在源中遇到的值应视为 "空"、"不存在 "或 "空白 "值
  • name[string]: 该项目的名称
  • owner[array]: 包含一个 JSON 编码字符序列的列表,其中引用了所有者的唯一 Ids
  • primaryKey[array]: 主键中的字段名 "必须 "是唯一的,并且 "必须 "与相关表中的字段名匹配。单值数组也是可以接受的,它表示单个字段的值就是主键。主键是一个字段名或字段名数组,其值 "必须 "唯一标识表中的每一行
  • seeAlso[*]: 指向有关该项目的其他资源的 uri 列表
  • source[string]: 以 URL 形式给出实体数据原始来源的字符串。建议使用源提供者的完全合格域名或源对象的 URL
  • type[string]: 必须是 TableSchemaFrictionlessData。NGSI 实体类型

所需属性

  • fields
  • id
  • type

该数据模型来自原始的无摩擦数据,可在 https://frictionlessdata.io/ 上找到。其中有几处改动1)id 和类型已成为 NGSI 标准的必选项 2)json 模式的结构已调整为智能数据模型的官方格式。参见贡献手册 https://bit.ly/contribution_manual

属性的数据模型描述

按字母顺序排列(点击查看详情)

full yaml details
TableSchemaFrictionlessData:      
  description: 'A Table Schema for this resource, compliant with the Table Schema specification. Converted for Smart Data Models initiative from original frictionless data'      
  properties:      
    alternateName:      
      description: An alternative name for this item      
      type: string      
      x-ngsi:      
        type: Property      
    dataProvider:      
      description: A sequence of characters identifying the provider of the harmonised data entity      
      type: string      
      x-ngsi:      
        type: Property      
    dateCreated:      
      description: Entity creation timestamp. This will usually be allocated by the storage platform      
      format: date-time      
      type: string      
      x-ngsi:      
        type: Property      
    dateModified:      
      description: Timestamp of the last modification of the entity. This will usually be allocated by the storage platform      
      format: date-time      
      type: string      
      x-ngsi:      
        type: Property      
    description:      
      description: A description of this item      
      type: string      
      x-ngsi:      
        type: Property      
    fields:      
      description: An array of Table Schema Field objects      
      items:      
        type: object      
      type: array      
      x-ngsi:      
        type: Property      
    foreignKeys:      
      description: ""      
      items:      
        type: string      
      type: array      
      x-ngsi:      
        type: Property      
    id:      
      anyOf:      
        - description: Identifier format of any NGSI entity      
          maxLength: 256      
          minLength: 1      
          pattern: ^[\w\-\.\{\}\$\+\*\[\]`|~^@!,:\\]+$      
          type: string      
          x-ngsi:      
            type: Property      
        - description: Identifier format of any NGSI entity      
          format: uri      
          type: string      
          x-ngsi:      
            type: Property      
      description: Unique identifier of the entity      
      x-ngsi:      
        type: Property      
    missingValues:      
      description: 'Many datasets arrive with missing data values, either because a value was not collected or it never existed. Missing values may be indicated simply by the value being empty in other cases a special value may have been used e.g. ''-'', ''NaN'', ''0'', ''-9999'' etc.The ''missingValues'' property provides a way to indicate that these values should be interpreted as equivalent to null. The ''missingValues'' are strings rather than being the data type of the particular field. This allows for comparison prior to casting and for fields to have missing value which are not of their type, for example a ''number'' field to have missing values indicated by ''-''.The default value of ''missingValue'' for a non-string type field is the empty string ''''. For string type fields there is no default for ''missingValue'' (for string fields the empty string '''' is a valid value and need not indicate null). Values that when encountered in the source, should be considered as ''null'', ''not present'', or ''blank'' values'      
      items:      
        type: string      
      type: array      
      x-ngsi:      
        type: Property      
    name:      
      description: The name of this item      
      type: string      
      x-ngsi:      
        type: Property      
    owner:      
      description: A List containing a JSON encoded sequence of characters referencing the unique Ids of the owner(s)      
      items:      
        anyOf:      
          - description: Identifier format of any NGSI entity      
            maxLength: 256      
            minLength: 1      
            pattern: ^[\w\-\.\{\}\$\+\*\[\]`|~^@!,:\\]+$      
            type: string      
            x-ngsi:      
              type: Property      
          - description: Identifier format of any NGSI entity      
            format: uri      
            type: string      
            x-ngsi:      
              type: Property      
        description: Unique identifier of the entity      
        x-ngsi:      
          type: Property      
      type: array      
      x-ngsi:      
        type: Property      
    primaryKey:      
      description: 'Field name in the primaryKey ''MUST'' be unique, and ''MUST'' match a field name in the associated table. It is acceptable to have an array with a single value, indicating that the value of a single field is the primary key. A primary key is a field name or an array of field names, whose values ''MUST'' uniquely identify each row in the table'      
      items:      
        type: string      
      minItems: 1      
      type: array      
      x-ngsi:      
        type: Property      
    seeAlso:      
      description: list of uri pointing to additional resources about the item      
      oneOf:      
        - items:      
            format: uri      
            type: string      
          minItems: 1      
          type: array      
        - format: uri      
          type: string      
      x-ngsi:      
        type: Property      
    source:      
      description: 'A sequence of characters giving the original source of the entity data as a URL. Recommended to be the fully qualified domain name of the source provider, or the URL to the source object'      
      type: string      
      x-ngsi:      
        type: Property      
    type:      
      description: it has to be TableSchemaFrictionlessData. NGSI entity type      
      type: string      
      x-ngsi:      
        type: Property      
  required:      
    - fields      
    - id      
    - type      
  type: object      
  x-derived-from: ""      
  x-disclaimer: 'Redistribution and use in source and binary forms, with or without modification, are permitted  provided that the license conditions are met. Copyleft (c) 2022 Contributors to Smart Data Models Program'      
  x-license-url: https://github.com/smart-data-models/dataModel.FrictionlessData/blob/master/TableSchemaFrictionlessData/LICENSE.md      
  x-model-schema: ""      
  x-model-tags: SDG      
  x-version: 0.0.2      

有效载荷示例

TableSchemaFrictionlessData NGSI-v2 键值示例

下面是一个以 JSON-LD 格式作为键值的 TableSchemaFrictionlessData 示例。当使用 options=keyValues 时,它与 NGSI-v2 兼容,并返回单个实体的上下文数据。

show/hide example
{  
  "id": "urn:ngsi-ld:TableSchemaFrictionlessData:XVFE:0034",  
  "type": "TableSchemaFrictionlessData",  
  "fields": [  
    {  
      "name": "first_name",  
      "type": "string",  
      "constraints": {  
        "required": true  
      }  
    },  
    {  
      "name": "age",  
      "type": "integer"  
    }  
  ],  
  "primaryKey": [  
    "name"  
  ]  
}  

TableSchemaFrictionlessData NGSI-v2 标准化示例

下面是一个规范化 JSON-LD 格式的 TableSchemaFrictionlessData 示例。当不使用选项时,它与 NGSI-v2 兼容,并返回单个实体的上下文数据。

show/hide example
{  
  "id": "urn:ngsi-ld:TableSchemaFrictionlessData:XVFE:0034",  
  "type": "TableSchemaFrictionlessData",  
  "fields": {  
    "type": "StructuredValue",  
    "value": [  
      {  
        "name": "first_name",  
        "type": "string",  
        "constraints": {  
          "required": true  
        }  
      },  
      {  
        "name": "age",  
        "type": "integer"  
      }  
    ]  
  },  
  "primaryKey": {  
    "type": "StructuredValue",  
    "value": [  
      "name"  
    ]  
  }  
}  

TableSchemaFrictionlessData NGSI-LD 键值示例

下面是一个以 JSON-LD 格式作为键值的 TableSchemaFrictionlessData 示例。当使用 options=keyValues 时,它与 NGSI-LD 兼容,并返回单个实体的上下文数据。

show/hide example
{  
  "id": "urn:ngsi-ld:TableSchemaFrictionlessData:XVFE:0034",  
  "type": "TableSchemaFrictionlessData",  
  "fields": [  
    {  
      "name": "first_name",  
      "type": "string",  
      "constraints": {  
        "required": true  
      }  
    },  
    {  
      "name": "age",  
      "type": "integer"  
    }  
  ],  
  "primaryKey": [  
    "name"  
  ],  
  "@context": [  
    "https://raw.githubusercontent.com/smart-data-models/dataModel.FrictionlessData/master/context.jsonld"  
  ]  
}  

TableSchemaFrictionlessData NGSI-LD 标准化示例

下面是一个规范化 JSON-LD 格式的 TableSchemaFrictionlessData 示例。当不使用选项时,它与 NGSI-LD 兼容,并返回单个实体的上下文数据。

show/hide example
{  
  "id": "urn:ngsi-ld:TableSchemaFrictionlessData:XVFE:0034",  
  "type": "TableSchemaFrictionlessData",  
  "fields": {  
    "type": "Property",  
    "value": [  
      {  
        "name": "first_name",  
        "type": "string",  
        "constraints": {  
          "required": true  
        }  
      },  
      {  
        "name": "age",  
        "type": "integer"  
      }  
    ]  
  },  
  "primaryKey": {  
    "type": "Property",  
    "value": [  
      "name"  
    ]  
  },  
  "@context": [  
        "https://raw.githubusercontent.com/smart-data-models/dataModel.FrictionlessData/master/context.jsonld"  
    ]  
}  

请参阅 FAQ 10,获取如何处理幅度单位的答案。


Smart Data Models +++ Contribution Manual +++ About