Movatterモバイル変換


[0]ホーム

URL:


W3C

Generating JSON from Tabular Data on the Web

W3C Recommendation

This version:
http://www.w3.org/TR/2015/REC-csv2json-20151217/
Latest published version:
http://www.w3.org/TR/csv2json/
Latest editor's draft:
http://w3c.github.io/csvw/csv2json/
Test suite:
http://www.w3.org/2013/csvw/tests/
Implementation report:
http://www.w3.org/2013/csvw/implementation_report.html
Previous version:
http://www.w3.org/TR/2015/PR-csv2json-20151117/
Editors:
Jeremy Tandy,Met Office
Ivan Herman,W3C
Repository:
We are on GitHub
File a bug
Changes:
Diff to previous version
Commit history

Please check theerrata for any errors or issues reported since publication.

This document is also available in this non-normative format:ePub

The English version of this specification is the only normative version. Non-normativetranslations may also be available.

Copyright © 2015W3C® (MIT,ERCIM,Keio,Beihang).W3Cliability,trademark anddocument use rules apply.


Abstract

This document defines the procedures and rules to be applied when converting tabular data into JSON. Tabular data may be complemented with metadata annotations that describe its structure, the meaning of its content and how it may form part of a collection of interrelated tabular data. This document specifies the effect of this metadata on the resulting JSON.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of currentW3C publications and the latest revision of this technical report can be found in theW3C technical reports index at http://www.w3.org/TR/.

TheCSV on the Web Working Group waschartered to produce a recommendation "Access methods for CSV Metadata" as well as recommendations for "Metadata vocabulary for CSV data" and "Mapping mechanism to transforming CSV into various formats (e.g., RDF, JSON, or XML)". This document aims to satisfy the JSON variant of the mapping recommendation.

This document was published by theCSV on the Web Working Group as a Recommendation. If you wish to make comments regarding this document, please send them topublic-csv-wg@w3.org (subscribe,archives). All comments are welcome.

Please see the Working Group'simplementation report.

This document has been reviewed byW3C Members, by software developers, and by otherW3C groups and interested parties, and is endorsed by the Director as aW3C Recommendation. It is a stable document and may be used as reference material or cited from another document.W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

This document was produced by a group operating under the5 February 2004W3C Patent Policy.W3C maintains apublic list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes containsEssential Claim(s) must disclose the information in accordance withsection 6 of theW3C Patent Policy.

This document is governed by the1 September 2015W3C Process Document.

Table of Contents

1.Introduction

This document describes the processing oftabular data to create a set of nested objects thatMUST be serialized as JSON [RFC7159].

Note

The conversion of CSV content to JSON is intended for web developers who need not care about the complexities of RDF [rdf11-concepts]. Where the formality of RDF is required, [csv2rdf] provides the procedures for mapping from CSV content to RDF which may be serialized to [json-ld].

The [tabular-data-model] defines anannotated tabular data model consisting oftables,columns,rows, andcells, enriched withannotations that describe the structure of thetabular data and the meaning of its content. Agroup of tables is a collection oftables published as a single atomic unit.

The conversion procedure described in this specification operates on theannotated tabular data model. This specification does not specify the processes needed to convert CSV-encoded data into tabular data form. Please refer to [tabular-data-model] for details ofparsing tabular data.

Conversion applicationsMUST provide at least two modes of operation:standard andminimal.

Standard mode conversion frames the information gleaned from thecells of thetabular data with details of therows,tables, and agroup of tables within which that information is provided.

Minimal mode conversion includesonly the information gleaned from thecells of thetabular data within the output.

Standard andminimal conversion are described normativelybelow.

Conversion applicationsMAY offer additional implementation specific conversion modes.

Transformation definitions, as defined in [tabular-metadata]MAY be used to specify howtabular data can be transformed into another format using a script or template. Suchtransformation definitionsMAY use the JSON output described in this specification as input.

2.Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

The key wordsMAY,MUST, andSHOULD are to be interpreted as described in [RFC2119].

Tabular dataMUST conform to the description from [tabular-data-model]. In particular note that eachrowMUST contain the same number ofcells (although some of thesecells may be empty).

Note

Not all CSV-encoded data can be parsed into a tabular data model. An algorithm for parsing CSV-based files is described in [tabular-data-model].

3.Typographical conventions

The following typographic conventions are used in this specification:

markup
Markup (elements, attributes, properties), machine processable values (string, characters, media types), property name, or a file name is in red-orange monospace font.
variable
A variable in pseudo-code or in an algorithm description is in italics.
definition
A definition of a term, to be used elsewhere in this or other specifications, is in bold and italics.
definition reference
A reference to a definitionin this document is underlined and is also an active link to the definition itself.
markup definition reference
A references to a definitionin this document, when the reference itself is also a markup, is underlined, red-orange monospace font, and is also an active link to the definition itself.
external definition reference
A reference to a definitionin another document is underlined, in italics, and is also an active link to the definition itself.
markup external definition reference
A reference to a definitionin another document, when the reference itself is also a markup, is underlined, in italics red-orange monospace font, and is also an active link to the definition itself.
hyperlink
A hyperlink is underlined and in blue.
[reference]
A document reference (normative or informative) is enclosed in square brackets and links to the references section.
Note

Notes are in light green boxes with a green left border and with a "Note" header in green. Notes are normative or informative depending on the whether they are in a normative or informative section, respectively.

Example 1
Examples are in light khaki boxes, with khaki left border, and with a numbered "Example" header in khaki. Examples are always informative. The content of the example is in monospace font and may be syntax colored.

4.Converting Tabular Data to JSON

The procedures for convertingtabular data into JSON are described below for bothstandard andminimal modes.

4.1Algorithm terms

about URL
Theabout URL annotation on the currentcell. As defined in [tabular-data-model].
annotated table
Theannotated table is defined in [tabular-data-model] as describing a particulartable and its annotations.
array
Anarray is defined in JSON ([RFC7159]) as an ordered sequence of zero or more values, where a value is a string, number, boolean, null,object, orarray.
cell
Acell is defined in [tabular-data-model] as the intersection of arow and acolumn within atable.
cell errors
Cell errors are defined in [tabular-data-model] as a (possibly empty) list of validation errors generated while parsing the literal content of acell to generate thesemantic value.
cell value
Acell value is defined in [tabular-data-model] as the semantic value of thecell; thisMAY benull or a sequence of values.
column
Acolumn is defined in [tabular-data-model] as a vertical arrangement ofcells within atable.
group of tables
Agroup of tables is defined in [tabular-data-model] as comprising a set ofannotated tables and a set of annotations that relate to that group.
group of tables identifier
The group of tables identifier is theid annotation on agroup of tables. As defined in [tabular-data-model].
name
In the context of this specification,name is used as defined in JSON ([RFC7159]); that is, thatname is a string that provides a unique key within a set of name-value pairs within a JSONobject.
non-core annotations
Core annotations are listed in [tabular-data-model];groups of tables andtables may also have other annotations that are not defined in that specification; these are known asnon-core annotations.
notes
A list ofnotes, as defined in [tabular-data-model], attached to anannotated table orgroup of tables using thenotes property. This may be an empty list.
object
Anobject is defined in JSON ([RFC7159]) as an unordered collection of zero or more name-value pairs, wherename is a string andvalue is a string, number, boolean, null,object, orarray.
property URL
Theproperty URL annotation on the currentcell. As defined in [tabular-data-model].
row
Therow is defined in [tabular-data-model] as a horizontal arrangement ofcells within atable.
row number
Arow number is defined in [tabular-data-model] as the position of therow within thetable, starting from 1.
row source number
Arow source number is defined in [tabular-data-model] as the position of therow within the sourcetabular data file. Provision of therow source number is dependent on parsing applications and may be reported asnull.
subject
Within this algorithm, asubject is the resource that the value of a givencell refers to. This may be specified usingabout URL.
table identifier
The table identifier is theid annotation on anannotated table. As defined in [tabular-data-model].
value URL
Thevalue URL annotation on the currentcell. As defined in [tabular-data-model].

4.2Generating JSON

A conformant JSON conversion applicationMUST produce output conforming to this algorithm according to the chosen mode of conversion:standard orminimal.

Note

Where anannotated table is defined in isolation (e.g. in the absence of agroup of tables), a defaultgroup of tables is provided with a singletables annotation that refers to the giventable.

The [tabular-data-model] specifies that string values withintabular data (such ascolumn titles orcell string values)MUST contain only Unicode characters. No Unicode normalization (as specified in [UAX15]) is applied to these string values during the conversion to JSON.

4.2.1Minimal mode

The steps in the algorithm defined here apply tominimal mode.

  1. Insert an emptyarrayA into the JSON output. Theobjects containing the name-value pairs associated with thecell values will be subsequently inserted into thisarray.

  2. Eachtable is processed sequentially in the order they are referenced in thegroup of tables. For eachtable where thesuppress output annotation isfalse:

    1. Eachrow within thetable is processed sequentially in order. For eachrow in the currenttable:

      1. Generate a sequence ofobjects,S1 toSn, each of which corresponds to asubject described by the currentrow, as described in4.3Generating Objects.

        Note

        Thesubject(s) described by eachrow are determined according to theabout URL annotation for eachcell in the currentrow. Whereabout URL is undefined, a defaultsubject for therow is used.

      2. As described in4.4Generating Nested Objects, process the sequence ofobjects,S1 toSn, to produce a new sequence ofrootobjects,SR1 toSRm, thatMAY includenestedobjects.

        Note

        ArowMAY describe multiple interrelatedsubjects; where thevalue URL annotation on onecell matches theabout URL annotation on anothercell in the samerow.

      3. Insert eachrootobject,SR1 toSRm, intoarrayA.

4.2.2Standard mode

The steps in the algorithm defined here apply tostandard mode.

  1. Insert an emptyobjectG into the JSON output which is associated with thegroup of tables.

  2. If thegroup of tables has anidentifierIG; insert the following name-value pair intoobjectG:

    name
    @id
    value
    IG
  3. Insert anynotes andnon-core annotations specified for thegroup of tables intoobjectG according to the rules provided in5.JSON-LD to JSON.

  4. Insert the following name-value pair intoobjectG:

    name
    tables
    value
    AT

    whereAT is anarray into which theobjects describing theannotated tables will be subsequently inserted.

  5. Eachtable is processed sequentially in the order they are referenced in thegroup of tables.

    For eachtable where thesuppress output annotation isfalse:

    1. Insert an emptyobjectT into thearrayAT to represent thetable.

    2. If thetable has anidentifierIT; insert the following name-value pair intoobjectT:

      name
      @id
      value
      IT
    3. Specify the source tabular data fileURL for the current table based on theurl annotation; insert the following name-value pair intoobjectT:

      name
      url
      value
      URL
    4. Insert anynotes andnon-core annotations specified for thetable intoobjectT according to the rules provided in5.JSON-LD to JSON.

      Note

      All othercore annotations for thetable are ignored during the conversion; including information abouttable schemas and theircolumns,foreign keys,table direction,transformations, etc.

    5. Insert the following name-value pair intoobjectT:

      name
      row
      value
      AR

      whereAR is anarray into which theobjects describing therows will be subsequently inserted.

    6. Eachrow within thetable is processed sequentially in order. For eachrow in the currenttable:

      1. Insert an emptyobjectR into thearrayAR to represent therow.

      2. Specify therow numbern for therow; insert the following name-value pair intoobjectR:

        name
        rownum
        value
        n
      3. Specify therow source numbernsource for therow within the source tabular data fileURL using a fragment-identifier as specified in [RFC7111]; ifrow source number is notnull, insert the following name-value pair intoobjectR:

        name
        url
        value
        URL#row=nsource
      4. Specify anytitles for therow; ifrow titles is notnull, insert the following name-value pair intoobjectR:

        name
        titles
        value
        t

        wheret is the single value or array of values provided by therow titles annotation.

        Note

        JSON has no native support for expressing language information; therefore any such information associated with therow titles is ignored.

      5. Insert anynon-core annotations specified for therow intoobjectR according to the rules provided in5.JSON-LD to JSON.

      6. Insert the following name-value pair intoobjectR:

        name
        describes
        value
        A

        whereA is anarray. Theobjects containing the name-value pairs associated with thecell values will be subsequently inserted into thisarray.

      7. Generate a sequence ofobjects,S1 toSn, each of which corresponds to asubject described by the currentrow, as described in4.3Generating Objects.

        Note

        Thesubject(s) described by eachrow are determined according to theabout URL annotation for eachcell in the currentrow. Whereabout URL is undefined, a defaultsubject for therow is used.

      8. As described in4.4Generating Nested Objects, process the sequence ofobjects,S1 toSn, to produce a new sequence ofrootobjects,SR1 toSRm, thatMAY includenestedobjects.

        Note

        ArowMAY describe multiple interrelatedsubjects; where thevalue URL annotation on onecell matches theabout URL annotation on anothercell in the samerow.

      9. Insert eachrootobject,SR1 toSRm, intoarrayA.

4.3Generating Objects

The steps in the algorithm defined here apply to bothstandardandminimal modes.

This algorithm generates a sequence ofobjects,S1 toSn, each of which corresponds to asubject described by the currentrow. The algorithm inserts name-value pairs intoSi depending on the cell values as outlined in the following steps.

  1. Determine the uniquesubjects for the currentrow. Thesubject(s) described by eachrow are determined according to theabout URL annotation for eachcell in the currentrow. A defaultsubject for therow is used for anycells whereabout URL is undefined.

  2. For eachsubject that the currentrow describes where at least one of thecells that refers to thatsubject has avalue orvalue URL that is notnull, and is associated with acolumn wheresuppress output annotation isfalse:

    1. Create an emptyobjectSi to represent thesubjecti.

      (i is the index number with values from1 ton, wheren is the number ofsubjects for therow)

      Subjecti is identified according to theabout URL annotation of its associatedcells:IS. For adefaultsubject whereabout URL is not specified by itscells,IS isnull.

    2. If the identifier forsubjecti,IS, is notnull, then insert the following name-value pair intoobjectSi:

      name
      @id
      value
      IS
    3. Eachcell referring tosubjecti is then processed sequentially according to the order of thecolumns.

      For eachcell referring tosubjecti, where thesuppress output annotation for thecolumn associated with thatcell isfalse, insert a name-value pair intoobjectSi as described below:

      1. If the value ofproperty URL for thecell is notnull, thennameN takes the value ofproperty URL compacted according to the rules as defined inURL Compaction in [tabular-metadata].

        Else,nameN takes the URI decoded value of thename annotation for thecolumn associated with thecell. (URI decoding is necessary asname may have been encoded if it was taken from a supplied title.)

      2. If thevalue URL for the currentcell is notnull, then insert the following name-value pair intoobjectSi:

        name
        N
        value
        Vurl

        whereVurl is the value ofvalue URL annotation for the currentcell expressed as a string in the JSON output. IfN is@type, compactVurl according to the rules as defined inURL Compaction in [tabular-metadata].

      3. Else, if thecell value is alist that is not empty, then thecell value provides a sequence of values for inclusion within the JSON output; insert anarrayAv containing each valueV of the sequence intoobjectSi:

        name
        N
        value
        Av

        Each of the valuesV derived from the sequenceMUST be expressed in the JSON output according to thedatatype ofV as defined below insection4.5Interpreting datatypes.

        Note

        Sincearrays are implicitlyordered in JSON, theordered annotation has no effect on the JSON output.

      4. Else, if thecell value is notnull, then thecell value provides a single valueV for inclusion within the JSON output; insert the following name-value pair intoobjectSi:

        name
        N
        value
        V

        ValueV derived from thecell valuesMUST be expressed in the JSON output according to thedatatype of the value as defined insection4.5Interpreting datatypes.

    4. IfnameN occurs more than once withinobjectSi, the name-value pairs from each occurrence ofnameNMUST be compacted to form a single name-value pair withnameN and whose value is an array containing all values from each of those name-value pairs. Where the value from one or more contributing name-value pairs is of type array, the values from contributing arrays are included directly to the resulting array (i.e. arrays of values are flattened).

4.4Generating Nested Objects

The steps in the algorithm defined herein apply to bothstandardandminimal modes.

Where the currentrow describes multiplesubjects, itMAY be possible to organize theobjects associated with thosesubjects such that someobjects arenested within others; e.g. where thevalue URL annotation for onecell matches theabout URL annotation for anothercell in the samerow. This algorithm considers a sequence ofobjects generated according to4.3Generating Objects,S1 toSn, each of which corresponds to asubject described by the currentrow. It generates a new sequence ofrootobjects,SR1 toSRm, thatMAY includenestedobjects.

Note

Where the currentrow describes only a singlesubject, this algorithm may be bypassed as no nesting is possible. In such a case, therootobjectSR1 is identical to the originalobjectS1.

Note

This nesting algorithm is based on the interrelationships betweensubjects described within a givenrow that are specified using thevalue URL annotation.Cell values expressing the identity of asubject in the currentrow (i.e., as a simple literal) will be ignored by this algorithm.

The algorithm uses the following terms:

child
If twovertices are connected in atree, the one which is further away from theroot of thetree is referred to as thechild of the other.
descendant
AvertexN is adescendant of avertexM if eitherN is thechildM, or there areverticesV1,…,Vk, such thatV1=M,Vk=N, andVk+1 is achild ofVk.
edge
One of the main constituents ofgraphs;edges are used to establish relationships amongvertices. In the context of this algorithm,edges are expressed in JSON using a name-value pair whose value is anotherobject or anarray ofobjects.
forest
A collection of disjointtrees. For the purpose of this algorithm, the order oftrees is important, i.e., forests can also be viewed as an ordered sequence ofroots.
graph
Data structure consisting ofvertices (or "nodes") andedges. See, for example, [Knuth] for further details.
node
Synonym ofvertex.
root
A dedicatedvertex in atree; aroot is not thechild of anyvertex.
tree
Atree (orrooted tree) is a connected, acyclicgraph where onevertex has been designated as theroot, in which case theedges have a natural orientationtowards oraway from theroot.
vertex
One of the main constituents ofgraphs; avertex usually holds further information or data. In the context of this algorithm,vertices are used to represent the JSONobjects.

The nesting algorithm is defined as follows:

  1. For allcells in the currentrow, determine thevalue URLs,Vurl, that occuronly once. The list of these uniquely occurringvalue URLs is referred to as theURL-list.

  2. Create an emptyforestF.Vertices in thetrees of thisforest represent thesubjects described by the currentrow.

  3. For eachobjectSi in the sequenceS1 toSn:

    1. Determine the identity ofobjectSi:IS. If present inobjectSi, the name-value pair withname@id provides the value ofIS. Else,objectSi is not explicitly identified andIS isnull.

    2. Check whether there is avertexN inforestF that representsobjectSi. If none of the existingvertices inforestF representobjectSi, then insert a newtree intoforestF whoseroot is avertexN that representsobjectSi and has identityIS.

    3. For allcells associated with the currentobjectSi (e.g. whoseabout URL annotation matchesIS):

      1. If thevalue URL annotation of the currentcell is defined and its value,Vurl, appears in theURL-list, then check each of theotherobjects in the sequenceS1 toSn to determine ifVurl identifies one of thoseobjects.

        ForobjectSj, if the name-value pair withname@id is present and its value matchesVurl, then:

        1. If theroot of thetree containingvertexN is avertex that representsobjectSj, thenobjectSi is already adescendant ofobjectSj; no further actionSHOULD be taken for this instance ofVurl.

          Note

          This clause in the algorithm prevents circular loops from being created.

          Furthermore, because theURL-list containsvalue URLs that occur only once for the currentrow,objectSi cannot be adescendant of intermediatevertices in thetree.

        2. Else, if there is arootvertexM inforestF that representsobjectSj, then setvertexM as achild ofvertexN and removevertexM from the list ofroots inforestF (i.e., thetree rooted byM becomes a sub-tree ofN).

        3. Else, create a newvertexM that representsobjectSj as achild ofvertexN.

  4. Eachvertex inforestF represents an object in the original sequence ofobjectsS1 toSn and is associated with asubject described by the currentrow. RearrangeobjectsS1 toSn such that they mirror the structure of thetrees inforestF as follows: IfvertexM, representingobjectSi, is achild ofvertexN, representingobjectSj, then the name-value pair inobjectSj associated with theedge relatingM andNMUST be modified such that the (literal) value,Vurl, from that name-value pair is replaced byobjectSi thus creating anestedobject.

    Note

    Objects represented byrootvertices are referred to asrootobjects.

  5. Return the sequence ofrootobjects,SR1 toSRm.

Note

An implementation may be able to optimize the algorithm by skipping branches (e.g. ifURL-list is empty) or by other means.

4.5Interpreting datatypes

Cell values are expressed in the JSON output according to thecell value's datatype. The relationship between thebase annotation value of thecell value's datatype and the primitive types supported by JSON (as specified in [RFC7159]) is provided below:

datatypeJSON primitive type
anyAtomicTypestring
anyURIstring
base64Binarystring
booleanboolean
datestring
dateTimestring
dateTimeStampstring
decimalnumber
integernumber
longnumber
intnumber
shortnumber
bytenumber
nonNegativeIntegernumber
positiveIntegernumber
unsignedLongnumber
unsignedIntnumber
unsignedShortnumber
unsignedBytenumber
nonPositiveIntegernumber
negativeIntegernumber
doublenumber
durationstring
dayTimeDurationstring
yearMonthDurationstring
floatnumber
gDaystring
gMonthstring
gMonthDaystring
gYearstring
gYearMonthstring
hexBinarystring
QNamestring
stringstring
normalizedStringstring
tokenstring
languagestring
Namestring
NMTOKENstring
xmlstring
htmlstring
jsonstring
timestring
Note

Instances of JSON reserved characters within string valuesMUST be escaped as defined in [RFC7159].

JSON has no native support for expressing language information; therefore thelanguage of a value has no effect on the JSON output.

Note

Only thebase annotation value is used to determine the primitive type used within the JSON output. Additional restrictions to thecell value's datatype, such as theid annotation, are ignored for the purposes of conversion to JSON.

Note

Adatatype'sformat is irrelevant to the conversion procedure defined in this specification; thecell value has already been parsed from the contents of thecell according to theformat annotation.

Cell errorsMUST be recorded by applications where the contents of acell cannot be parsed or validated (seeParsing Cells andValidating Tables in [tabular-data-model] respectively). In cases wherecell errors are recorded, applications may attempt to determine the appropriate JSON primitive type during the subsequent conversion process according to local rules.

5.JSON-LD to JSON

This section defines a mechanism for transforming the [json-ld]dialect used fornon-core annotations andnotes originating from the processing of metadata (as defined in [tabular-metadata]) into JSON.

Note

Conversion applications may have other means to createannotated tables, e.g. through some application specific APIs. In such cases the exact format for non-core annotations or notes may be different. Specifications for such annotation processes should specify how these annotations are converted into JSON.

Name-value pairs fromnotes andnon-core annotations annotations are generally copied verbatim from the metadata description subject to the exceptions below:

  1. Name-value pairs whose value is anobject using the [json-ld] keyword@value, for example:

    name
    N
    value
    { "@value": "V" }

    are transformed to:

    name
    N
    value
    V

    Name-value pairs occurring within the value object that use [json-ld] keywords@language and@type are ignored.

  2. Name-value pairs whose value is anobject using the [json-ld] keyword@id to coerce a string-value to be interpreted as an IRI, for example:

    name
    N
    value
    { "@id": "Vurl" }

    are transformed to:

    name
    N
    value
    Vurl

In addition to compacting values ofproperty URLs, URLs which were the value ofobjects using the [json-ld] keyword@type are compacted according to the rules as defined inURL Compaction in [tabular-metadata].

6.Examples

This section is non-normative.

Note

Each of the examples expresses more complex conversions - it is recommended that readers of this specification work through the examples in sequential order.

6.1Simple example

This example comprises a singleannotated table containing information attributes about countries; country code, position (latitude, longitude) and name. Whilst the input tabular data file, published athttp://example.org/countries.csv, includes aheader line, no further metadata annotations are given. The tabular data file is provided below:

Example 2: http://example.org/countries.csv
countryCode,latitude,longitude,nameAD,42.5,1.6,AndorraAE,23.4,53.8,"United Arab Emirates"AF,33.9,67.7,Afghanistan

Theannotated table generated from parsing the tabular data file is shown below and provides the basis for the conversion to JSON.

Annotations for the resultingtableT, with 4 columns and 3 rows, are shown below:

idcore annotations
urlcolumnsrows
Thttp://example.org/countries.csvC1,C2,C3,C4R1,R2,R3

Annotations for thecolumns,rows andcells intableT are shown in the tables below:

Column annotations:

idcore annotations
tablenumbersource numbercellsnametitles
C1T11C1.1,C2.1,C3.1countryCodecountryCode
C2T22C1.2,C2.2,C3.2latitudelatitude
C3T33C1.3,C2.3,C3.3longitudelongitude
C4T44C1.4,C2.4,C3.4namename

Row annotations:

idcore annotations
tablenumbersource numbercells
R1T12C1.1,C1.2,C1.3,C1.4
R2T23C2.1,C2.2,C2.3,C2.4
R3T34C3.1,C3.2,C3.3,C3.4

Cell annotations:

idcore annotations
tablecolumnrowstring valuevalueproperty URL
C1.1TC1R1"AD""AD"null
C1.2TC2R1"42.5""42.5"null
C1.3TC3R1"1.6""1.6"null
C1.4TC4R1"Andorra""Andorra"null
C2.1TC1R2"AE""AE"null
C2.2TC2R2"23.4""23.4"null
C2.3TC3R2"53.8""53.8"null
C2.4TC4R2"United Arab Emirates""United Arab Emirates"null
C3.1TC1R3"AF""AF"null
C3.2TC2R3"33.9""33.9"null
C3.3TC3R3"67.7""67.7"null
C3.4TC4R3"Afghanistan""Afghanistan"null

Minimal mode output for this example is provided below:

Example 3: http://example.org/countries-minimal.json
[{"countryCode":"AD","latitude":"42.5","longitude":"1.6","name":"Andorra"},{"countryCode":"AE","latitude":"23.4","longitude":"53.8","name":"United Arab Emirates"},{"countryCode":"AF","latitude":"33.9","longitude":"67.7","name":"Afghanistan"}]
Note

Theabout URL annotation has not been set for cells in tableT ({ "url": "http://example.org/countries.csv"});cells in a givenrow whereabout URL has not been specified are assumed to refer to the samesubject and so the name-value pairs associated with thecell values of thatrow occur within the sameobject.

Given that theproperty URL isnull for cells in tableT ({ "url": "http://example.org/countries.csv"}), the simplifiedname is used in the name-value pairs; e.g.countryCode rather thanhttp://example.org/countries.csv#countryCode

Standard mode output for this example is provided below:

Example 4: http://example.org/countries-standard.json
{"tables":[{"url":"http://example.org/countries.csv","row":[{"url":"http://example.org/countries.csv#row=2","rownum":1,"describes":[{"countryCode":"AD","latitude":"42.5","longitude":"1.6","name":"Andorra"}]},{"url":"http://example.org/countries.csv#row=3","rownum":2,"describes":[{"countryCode":"AE","latitude":"23.4","longitude":"53.8","name":"United Arab Emirates"}]},{"url":"http://example.org/countries.csv#row=4","rownum":3,"describes":[{"countryCode":"AF","latitude":"33.9","longitude":"67.7","name":"Afghanistan"}]}]}]}
Note

Even though thetable was defined in isolation, theannotated table is wrapped in agroup of tables.

The name-value pair withnameurl provides reference to the original tabular data file and to specificrows therein.

Therow number is provided for eachrow using name-value pair withnamerownum.

Theobject containing the name-values pairs associated with thecell values of arow are related to theobject for thatrow using the name-value pair withnamedescribes.

6.2Example with single table and rich annotations

This example is based onUse Case #11 - City of Palo Alto Tree Data and comprises a singleannotated table describing an inventory of tree maintenance operations. The input tabular data file, published athttp://example.org/tree-ops-ext.csv, and the associated metadata descriptionhttp://example.org/tree-ops-ext.csv-metadata.json are provided below:

Example 5: http://example.org/tree-ops-ext.csv
GID,On Street,Species,Trim Cycle,Diameter at Breast Ht,Inventory Date,Comments,Protected,KML1,ADDISON AV,Celtis australis,Large Tree Routine Prune,11,10/18/2010,,,"<Point><coordinates>-122.156485,37.440963</coordinates></Point>"2,EMERSON ST,Liquidambar styraciflua,Large Tree Routine Prune,11,6/2/2010,,,"<Point><coordinates>-122.156749,37.440958</coordinates></Point>"6,ADDISON AV,Robinia pseudoacacia,Large Tree Routine Prune,29,6/1/2010,cavity or decay; trunk decay; codominant leaders; included bark; large leader or limb decay; previous failure root damage; root decay;  beware of BEES,YES,"<Point><coordinates>-122.156299,37.441151</coordinates></Point>"
Example 6: http://example.org/tree-ops-ext.csv-metadata.json
{"@context":["http://www.w3.org/ns/csvw",{"@language":"en"}],"@id":"http://example.org/tree-ops-ext","url":"tree-ops-ext.csv","dc:title":"Tree Operations","dcat:keyword":["tree","street","maintenance"],"dc:publisher":[{"schema:name":"Example Municipality","schema:url":{"@id":"http://example.org"}}],"dc:license":{"@id":"http://opendefinition.org/licenses/cc-by/"},"dc:modified":{"@value":"2010-12-31","@type":"xsd:date"},"notes":[{"@type":"oa:Annotation","oa:hasTarget":{"@id":"http://example.org/tree-ops-ext"},"oa:hasBody":{"@type":"oa:EmbeddedContent","rdf:value":"This is a very interesting comment about the table; it's a table!","dc:format":{"@value":"text/plain"}}}],"dialect":{"trim":true},"tableSchema":{"columns":[{"name":"GID","titles":["GID","Generic Identifier"],"dc:description":"An identifier for the operation on a tree.","datatype":"string","required":true,"suppressOutput":true},{"name":"on_street","titles":"On Street","dc:description":"The street that the tree is on.","datatype":"string"},{"name":"species","titles":"Species","dc:description":"The species of the tree.","datatype":"string"},{"name":"trim_cycle","titles":"Trim Cycle","dc:description":"The operation performed on the tree.","datatype":"string","lang":"en"},{"name":"dbh","titles":"Diameter at Breast Ht","dc:description":"Diameter at Breast Height (DBH) of the tree (in feet), measured 4.5ft above ground.","datatype":"integer"},{"name":"inventory_date","titles":"Inventory Date","dc:description":"The date of the operation that was performed.","datatype":{"base":"date","format":"M/d/yyyy"}},{"name":"comments","titles":"Comments","dc:description":"Supplementary comments relating to the operation or tree.","datatype":"string","separator":";"},{"name":"protected","titles":"Protected","dc:description":"Indication (YES / NO) whether the tree is subject to a protection order.","datatype":{"base":"boolean","format":"YES|NO"},"default":"NO"},{"name":"kml","titles":"KML","dc:description":"KML-encoded description of tree location.","datatype":"xml"}],"primaryKey":"GID","aboutUrl":"http://example.org/tree-ops-ext#gid-{GID}"}}
Note

Thenotes annotation in the metadata description uses theOpen Annotation data model currently under development within theWeb Annotations Working Group. This is purely illustrative; no constraints are placed on the value of thenotes annotation.

Theannotated table generated from parsing the tabular data file and associated metadata is shown below and provides the basis for the conversion to JSON.

Core annotations for the resultingtableT, with 9columns and 3rows, are shown below:

idcore annotations
idurlcolumnsrowsnotes
T<http://example.org/tree-ops-ext>http://example.org/tree-ops-ext.csvC1,C2,C3,C4,C5,C6,C7,C8,C9R1,R2,R3[{ "@type": "oa:Annotation", ... }]

Non-core annotations for thetableT are:

dc:title
"Tree Operations"
dcat:keyword
["tree", "street", "maintenance"]
dc:publisher
[{ "schema:name": "Example Municipality", "schema:url": { "@id": "http://example.org" } }]
dc:license
{ "@id": "http://opendefinition.org/licenses/cc-by/" }
dc:modified
"2010-12-31"
Note

The value of thenotes annotation has been shortened for clarity in the table above.

Annotations for thecolumns,rows andcells intableT are shown in the tables below:

Column annotations:

idcore annotationsannotations
tablenumbersource numbercellsnametitlesrequiredsuppress outputdc:description
C1T11C1.1,C2.1,C3.1GIDGID,Generic IdentifiertruetrueAn identifier for the operation on a tree.
C2T22C1.2,C2.2,C3.2on_streetOn StreetThe street that the tree is on.
C3T33C1.3,C2.3,C3.3speciesSpeciesThe species of the tree.
C4T44C1.4,C2.4,C3.4trim_cycleTrim CycleThe operation performed on the tree.
C5T55C1.5,C2.5,C3.5dbhDiameter at Breast HtDiameter at Breast Height (DBH) of the tree (in feet), measured 4.5ft above ground.
C6T66C1.6,C2.6,C3.6inventory_dateInventory DateThe date of the operation that was performed.
C7T77C1.7,C2.7,C3.7commentsCommentsSupplementary comments relating to the operation or tree.
C8T88C1.8,C2.8,C3.8protectedProtectedIndication (YES / NO) whether the tree is subject to a protection order.
C9T99C1.9,C2.9,C3.9kmlKMLKML-encoded description of tree location.
Note

In this example, output forcolumnC1 (GID) is not required; note thesuppress output annotation on thiscolumn.

Row annotations:

idcore annotations
tablenumbersource numbercellsprimary key
R1T12C1.1,C1.2,C1.3,C1.4,C1.5,C1.6,C1.7,C1.8,C1.9C1.1
R2T23C2.1,C2.2,C2.3,C2.4,C2.5,C2.6,C2.7,C2.8,C2.9C2.1
R3T34C3.1,C3.2,C3.3,C3.4,C3.5,C3.6,C3.7,C3.8,C3.9C3.1

Cell annotations:

idcore annotations
tablecolumnrowstring valuevalueabout URL
C1.1TC1R1"1""1"http://example.org/tree-ops-ext#gid-1
C1.2TC2R1"ADDISON AV""ADDISON AV"<http://example.org/tree-ops-ext#gid-1>
C1.3TC3R1"Celtis australis""Celtis australis"<http://example.org/tree-ops-ext#gid-1>
C1.4TC4R1"Large Tree Routine Prune""Large Tree Routine Prune" (English)<http://example.org/tree-ops-ext#gid-1>
C1.5TC5R1"11"11<http://example.org/tree-ops-ext#gid-1>
C1.6TC6R1"10/18/2010"2010-10-18<http://example.org/tree-ops-ext#gid-1>
C1.7TC7R1""null<http://example.org/tree-ops-ext#gid-1>
C1.8TC8R1""false<http://example.org/tree-ops-ext#gid-1>
C1.9TC9R1"<Point><coordinates>-122.156485,37.440963</coordinates></Point>""<Point><coordinates>-122.156485,37.440963</coordinates></Point>" (XML)<http://example.org/tree-ops-ext#gid-1>
C2.1TC1R2"2""2"<http://example.org/tree-ops-ext#gid-2>
C2.2TC2R2"EMERSON ST""EMERSON ST"<http://example.org/tree-ops-ext#gid-2>
C2.3TC3R2"Liquidambar styraciflua""Liquidambar styraciflua"<http://example.org/tree-ops-ext#gid-2>
C2.4TC4R2"Large Tree Routine Prune""Large Tree Routine Prune" (English)<http://example.org/tree-ops-ext#gid-2>
C2.5TC5R2"11"11<http://example.org/tree-ops-ext#gid-2>
C2.6TC6R2"6/2/2010"2010-06-02<http://example.org/tree-ops-ext#gid-2>
C2.7TC7R2""null<http://example.org/tree-ops-ext#gid-2>
C2.8TC8R2""false<http://example.org/tree-ops-ext#gid-2>
C2.9TC9R2"<Point><coordinates>-122.156749,37.440958</coordinates></Point>""<Point><coordinates>-122.156749,37.440958</coordinates></Point>" (XML)<http://example.org/tree-ops-ext#gid-2>
C3.1TC1R3"6""6"<http://example.org/tree-ops-ext#gid-6>
C3.2TC2R3"ADDISON AV""ADDISON AV"<http://example.org/tree-ops-ext#gid-6>
C3.3TC3R3"Robinia pseudoacacia""Robinia pseudoacacia"<http://example.org/tree-ops-ext#gid-6>
C3.4TC4R3"Large Tree Routine Prune""Large Tree Routine Prune" (English)<http://example.org/tree-ops-ext#gid-6>
C3.5TC5R3"29"29<http://example.org/tree-ops-ext#gid-6>
C3.6TC6R3"6/1/2010"2010-06-01<http://example.org/tree-ops-ext#gid-6>
C3.7TC7R3"cavity or decay; trunk decay; codominant leaders; included bark; large leader or limb decay; previous failure root damage; root decay; beware of BEES""cavity or decay","trunk decay","codominant leaders","included bark","large leader or limb decay","previous failure root damage","root decay","beware of BEES"<http://example.org/tree-ops-ext#gid-6>
C3.8TC8R3"YES"true<http://example.org/tree-ops-ext#gid-6>
C3.9TC9R3"<Point><coordinates>-122.156299,37.441151</coordinates></Point>""<Point><coordinates>-122.156299,37.441151</coordinates></Point>" (XML)<http://example.org/tree-ops-ext#gid-6>
Note

The lists of values fromcells incolumnC7 ("name": "comments") are assumed to beunordered as the booleanordered annotation, which defaults tofalse, has not be set within the metadata description.

Minimal mode output for this example is provided below:

Example 7: http://example.org/tree-ops-ext-minimal.json
[{"@id":"http://example.org/tree-ops-ext#gid-1","on_street":"ADDISON AV","species":"Celtis australis","trim_cycle":"Large Tree Routine Prune","dbh":11,"inventory_date":"2010-10-18","protected":false,"kml":"<Point><coordinates>-122.156485,37.440963</coordinates></Point>"},{"@id":"http://example.org/tree-ops-ext#gid-2","on_street":"EMERSON ST","species":"Liquidambar styraciflua","trim_cycle":"Large Tree Routine Prune","dbh":11,"inventory_date":"2010-06-02","protected":false,"kml":"<Point><coordinates>-122.156749,37.440958</coordinates></Point>"},{"@id":"http://example.org/tree-ops-ext#gid-6","on_street":"ADDISON AV","species":"Robinia pseudoacacia","trim_cycle":"Large Tree Routine Prune","dbh":29,"inventory_date":"2010-06-01","comments":["cavity or decay","trunk decay","codominant leaders","included bark","large leader or limb decay","previous failure root damage","root decay","beware of BEES"],"protected":true,"kml":"<Point><coordinates>-122.156299,37.441151</coordinates></Point>"}]
Note

Thesubject described by eachrow is explicitly defined using theabout URL annotation; e.g. thesubject ofrowR1 ishttp://example.org/tree-ops-ext#gid-1.

Output forcolumnC1 ({ "name": "GID" }) is not included ascolumnsuppress output annotation istrue.

CellsC1.7 andC2.7 (rowsR1 andR2;column,{ "name": "comments" }) havenullvalues - no output is included for thesecells.

CellC3.7 (rowR3;column,{ "name": "comments" }) contains a sequence of values; the set of values are included in anarray.

Standard mode output for this example is provided below:

Example 8: http://example.org/tree-ops-ext-standard.json
{"tables":[{"@id":"http://example.org/tree-ops-ext","url":"http://example.org/tree-ops-ext.csv","dc:title":"Tree Operations","dcat:keyword":["tree","street","maintenance"],"dc:publisher":[{"schema:name":"Example Municipality","schema:url":"http://example.org"}],"dc:license":"http://opendefinition.org/licenses/cc-by/","dc:modified":"2010-12-31","notes":[{"@type":"oa:Annotation","oa:hasTarget":"http://example.org/tree-ops-ext","oa:hasBody":{"@type":"oa:EmbeddedContent","rdf:value":"This is a very interesting comment about the table; it's a table!","dc:format":"text/plain"}}],"row":[{"url":"http://example.org/tree-ops-ext.csv#row=2","rownum":1,"describes":[{"@id":"http://example.org/tree-ops-ext#gid-1","on_street":"ADDISON AV","species":"Celtis australis","trim_cycle":"Large Tree Routine Prune","dbh":11,"inventory_date":"2010-10-18","protected":false,"kml":"<Point><coordinates>-122.156485,37.440963</coordinates></Point>"}]},{"url":"http://example.org/tree-ops-ext.csv#row=3","rownum":2,"describes":[{"@id":"http://example.org/tree-ops-ext#gid-2","on_street":"EMERSON ST","species":"Liquidambar styraciflua","trim_cycle":"Large Tree Routine Prune","dbh":11,"inventory_date":"2010-06-02","protected":false,"kml":"<Point><coordinates>-122.156749,37.440958</coordinates></Point>"}]},{"url":"http://example.org/tree-ops-ext.csv#row=4","rownum":3,"describes":[{"@id":"http://example.org/tree-ops-ext#gid-6","on_street":"ADDISON AV","species":"Robinia pseudoacacia","trim_cycle":"Large Tree Routine Prune","dbh":29,"inventory_date":"2010-06-01","comments":["cavity or decay","trunk decay","codominant leaders","included bark","large leader or limb decay","previous failure root damage","root decay","beware of BEES"],"protected":true,"kml":"<Point><coordinates>-122.156299,37.441151</coordinates></Point>"}]}]}]}
Note

TableT ({ "url": "http://example.org/tree-ops-ext.csv"}) has been explicitly identified:{ "@id": "<http://exmple.org/tree-ops-ext>"}.

Non-core annotations andnotes specified fortableT ({ "url": "http://example.org/tree-ops-ext.csv"}) are included in the output.

6.3Example with single table and usingvirtual columns to produce multiple subjects per row

This example uses a singleannotated table describing a listing of music events. Eachrow from the tabular data file corresponds to three resources; the music event itself, the location where that event occurs and the offer to sell tickets for that event. The goal is to convert the CSV content intoschema.org markup that a search engine such asGoogle can use to index music events. Details of how Google expects this information to be structured can be foundhere.

The input tabular data file, published athttp://example.org/events-listing.csv, and the associated metadata descriptionhttp://example.org/events-listing.csv-metadata.json are provided below:

Example 9: http://example.org/events-listing.csv
Name, Start Date, Location Name, Location Address, Ticket UrlB.B. King,2014-04-12T19:30,"Lupo’s Heartbreak Hotel","79 Washington St., Providence, RI",https://www.etix.com/ticket/1771656B.B. King,2014-04-13T20:00,"Lynn Auditorium","Lynn, MA, 01901",http://frontgatetickets.com/venue.php?id=11766
Example 10: http://example.org/events-listing.csv-metadata.json
{"@context":["http://www.w3.org/ns/csvw",{"@language":"en"}],"url":"events-listing.csv","dialect":{"trim":true},"tableSchema":{"columns":[{"name":"name","titles":"Name","aboutUrl":"#event-{_row}","propertyUrl":"schema:name"},{"name":"start_date","titles":"Start Date","datatype":{"base":"datetime","format":"yyyy-MM-ddTHH:mm"},"aboutUrl":"#event-{_row}","propertyUrl":"schema:startDate"},{"name":"location_name","titles":"Location Name","aboutUrl":"#place-{_row}","propertyUrl":"schema:name"},{"name":"location_address","titles":"Location Address","aboutUrl":"#place-{_row}","propertyUrl":"schema:address"},{"name":"ticket_url","titles":"Ticket Url","datatype":"anyURI","aboutUrl":"#offer-{_row}","propertyUrl":"schema:url"},{"name":"type_event","virtual":true,"aboutUrl":"#event-{_row}","propertyUrl":"rdf:type","valueUrl":"schema:MusicEvent"},{"name":"type_place","virtual":true,"aboutUrl":"#place-{_row}","propertyUrl":"rdf:type","valueUrl":"schema:Place"},{"name":"type_offer","virtual":true,"aboutUrl":"#offer-{_row}","propertyUrl":"rdf:type","valueUrl":"schema:Offer"},{"name":"location","virtual":true,"aboutUrl":"#event-{_row}","propertyUrl":"schema:location","valueUrl":"#place-{_row}"},{"name":"offers","virtual":true,"aboutUrl":"#event-{_row}","propertyUrl":"schema:offers","valueUrl":"#offer-{_row}"}]}}
Note

The CSV to JSON translation is limited to providing one statement, or triple, percolumn in thetable. The targetschema.org markup requires 10 statements to describe each event. As the base tabular data file contains 5 columns, an additional 5virtualcolumns have been added in order to provide for the full complement of statements—including the relationships between the 3 resources (event, location, and offer) described by eachrow of thetable. Note that thevirtual annotation istrue for thesevirtualcolumns.

Furthermore, note that no attempt is made to reconcile between locations or offers that may be associated with more than one event; everyrow in thetable will create both a new location resource and offer resource in addition to the event resource. If considered necessary, applications such asOpenRefine may be used to identify and reconcile duplicate location resources once the JSON output has been generated.

Theannotated table generated from parsing the tabular data file and associated metadata is shown below and provides the basis for the conversion to JSON.

Annotations for the resultingtableT, with 10columns and 2rows, are shown below:

idcore annotations
urlcolumnsrows
Thttp://example.org/events-listing.csvC1,C2,C3,C4,C5,C6,C7,C8,C9,C10R1,R2

Annotations for thecolumns,rows andcells intableT are shown in the tables below:

Column annotations:

idcore annotations
tablenumbersource numbercellsnametitlesvirtual
C1T11C1.1,C2.1nameName
C2T22C1.2,C2.2start_dateStart Date
C3T33C1.3,C2.3location_nameLocation Name
C4T44C1.4,C2.4location_addressLocation Address
C5T55C1.5,C2.5ticket_urlTicket Url
C6T66C1.6,C2.6type_eventtrue
C7T77C1.7,C2.7type_placetrue
C8T88C1.8,C2.8type_offertrue
C9T99C1.9,C2.9locationtrue
C10T1010C1.10,C2.10offerstrue

Row annotations:

idcore annotations
tablenumbersource numbercells
R1T12C1.1,C1.2,C1.3,C1.4,C1.5,C1.6,C1.7,C1.8,C1.9,C1.10
R2T23C2.1,C2.2,C2.3,C2.4,C2.5,C2.6,C2.7,C2.8,C2.9,C2.10

Cell annotations:

idcore annotations
tablecolumnrowstring valuevalueabout URLproperty URLvalue URL
C1.1TC1R1"B.B. King""B.B. King"<http://example.org/events-listing.csv#event-1>schema:name
C1.2TC2R1"2014-04-12T19:30"2014-04-12T19:30:00<http://example.org/events-listing.csv#event-1>schema:startDate
C1.3TC3R1"Lupo’s Heartbreak Hotel""Lupo’s Heartbreak Hotel"<http://example.org/events-listing.csv#place-1>schema:name
C1.4TC4R1"79 Washington St., Providence, RI""79 Washington St., Providence, RI"<http://example.org/events-listing.csv#place-1>schema:address
C1.5TC5R1"https://www.etix.com/ticket/1771656"<https://www.etix.com/ticket/1771656><http://example.org/events-listing.csv#offer-1>schema:url
C1.6TC6R1""null<http://example.org/events-listing.csv#event-1>rdf:typeschema:MusicEvent
C1.7TC7R1""null<http://example.org/events-listing.csv#place-1>rdf:typeschema:Place
C1.8TC8R1""null<http://example.org/events-listing.csv#offer-1>rdf:typeschema:Offer
C1.9TC9R1""null<http://example.org/events-listing.csv#event-1>schema:location<http://example.org/events-listing.csv#place-1>
C1.10TC10R1""null<http://example.org/events-listing.csv#event-1>schema:offers<http://example.org/events-listing.csv#offer-1>
C2.1TC1R2"B.B. King""B.B. King"<http://example.org/events-listing.csv#event-2>schema:name
C2.2TC2R2"2014-04-13T20:00"2014-04-13T20:00:00<http://example.org/events-listing.csv#event-2>schema:startDate
C2.3TC3R2"Lynn Auditorium""Lynn Auditorium"<http://example.org/events-listing.csv#place-2>schema:name
C2.4TC4R2"Lynn, MA, 01901""Lynn, MA, 01901"<http://example.org/events-listing.csv#place-2>schema:address
C2.5TC5R2"http://frontgatetickets.com/venue.php?id=11766"<http://frontgatetickets.com/venue.php?id=11766><http://example.org/events-listing.csv#offer-2>schema:url
C2.6TC6R2""null<http://example.org/events-listing.csv#event-2>rdf:typeschema:MusicEvent
C2.7TC7R2""null<http://example.org/events-listing.csv#place-2>rdf:typeschema:Place
C2.8TC8R2""null<http://example.org/events-listing.csv#offer-2>rdf:typeschema:Offer
C2.9TC9R2""null<http://example.org/events-listing.csv#event-2>schema:location<http://example.org/events-listing.csv#place-2>
C2.10TC10R2""null<http://example.org/events-listing.csv#event-2>schema:offers<http://example.org/events-listing.csv#offer-2>

Minimal mode output for this example is provided below:

Example 11: http://example.org/events-listing-minimal.json
[{"@id":"http://example.org/events-listing.csv#event-1","@type":"schema:MusicEvent","schema:name":"B.B. King","schema:startDate":"2014-04-12T19:30:00","schema:location":{"@id":"http://example.org/events-listing.csv#place-1","@type":"schema:Place","schema:name":"Lupo’s Heartbreak Hotel","schema:address":"79 Washington St., Providence, RI"},"schema:offer":{"@id":"http://example.org/events-listing.csv#offer-1","@type":"schema:Offer","schema:offer":"https://www.etix.com/ticket/1771656"}},{"@id":"http://example.org/events-listing.csv#event-2","@type":"schema:MusicEvent","schema:name":"B.B. King","schema:startDate":"2014-04-13T20:00:00","schema:location":{"@id":"http://example.org/events-listing.csv#place-2","@type":"schema:Place","schema:name":"Lynn Auditorium","schema:address":"Lynn, MA, 01901"},"schema:offer":{"@id":"http://example.org/events-listing.csv#offer-2","@type":"schema:Offer","schema:offer":"http://frontgatetickets.com/venue.php?id=11766"}}]
Note

Three resources are defined for each row within the table; event, location and offer. Therefore threeobjects are created for eachrow.

Eachcolumn description explicitly defines bothaboutUrl andpropertyUrl properties which are used to create theabout URL andproperty URL annotations on the column'scells.

ColumnsC6,C7 andC8 ({ "name": "type_event"},{ "name": "type_place"} and{ "name": "type_offer"}) define the semantic types of the resources described by eachrow:schema:MusicEvent,schema:Place andschema:Offer respectively—noting that the use ofrdf:type is converted to thename@type (as used in [json-ld]) by this conversion application.

ColumnC9 ({ "name": "location"}) uses theabout URL,property URL andvalue URL to assert the relationship between the event and location resources.

ColumnC10 ({ "name": "offer"}) uses theabout URL,property URL andvalue URL to assert the relationship between the event and offer resources.

Standard mode output for this example is provided below:

Example 12: http://example.org/events-listing-standard.json
{"tables":[{"url":"http://example.org/events-listing.csv","row":[{"url":"http://example.org/events-listing.csv#row=2","rownum":1,"describes":[{"@id":"http://example.org/events-listing.csv#event-1","@type":"schema:MusicEvent","schema:name":"B.B. King","schema:startDate":"2014-04-12T19:30:00","schema:location":{"@id":"http://example.org/events-listing.csv#place-1","@type":"schema:Place","schema:name":"Lupo’s Heartbreak Hotel","schema:address":"79 Washington St., Providence, RI"},"schema:offers":{"@id":"http://example.org/events-listing.csv#offer-1","@type":"schema:Offer","schema:url":"https://www.etix.com/ticket/1771656"}}]},{"url":"http://example.org/events-listing.csv#row=3","rownum":2,"describes":[{"@id":"http://example.org/events-listing.csv#event-2","@type":"schema:MusicEvent","schema:name":"B.B. King","schema:startDate":"2014-04-13T20:00:00","schema:location":{"@id":"http://example.org/events-listing.csv#place-2","@type":"schema:Place","schema:name":"Lynn Auditorium","schema:address":"Lynn, MA, 01901"},"schema:offers":{"@id":"http://example.org/events-listing.csv#offer-2","@type":"schema:Offer","schema:url":"http://frontgatetickets.com/venue.php?id=11766"}}]}]}]}
Note

The resources described by eachrow are explicitly defined using theabout URL annotation—in this case three resources perrow (event, location, and offer). Theobjects containing the name-values pairs associated with thecell values of arow are related to theobject for eachsubject in thatrow using the name-value pair withnamedescribes.

6.4Example with table group comprising four interrelated tables

This example is based onUse Case #4 - Publication of public sector roles and salaries and uses fourannotated tables published as agroup of tables. Information about senior roles and junior roles within a government department or organization are published in CSV format by each department. These are validated against a centrally publishedschema to ensure that all the data published by departments is consistent. Additionally, lists of organizations and professions are also published centrally, providingcontrolled vocabularies against which departmental submissions are validated.

Information published about junior and senior roles provides summary information for each post within the government department or organization. Whilst the junior role information is anonymous, providing only an indication of the number of full-time-equivalent (FTE) staff occupying a given post, the senior role information specifies the named individual occupying each post. As such, eachrow from the tabular data file describing senior roles corresponds to two resources; thepost and theperson occupying that post.

This example is concerned only with converting the information provided by each government department or organization rather than the centrally published information listing organizations and professions.

The input tabular data files and associated metadata descriptions are provided below:

Example 13: http://example.org/gov.uk/data/organizations.csv
Organization Unique Reference,Organization Name,Department Referencehefce.ac.uk,Higher Education Funding Council for England,bis.gov.ukbis.gov.uk,"Department for Business, Innovation and Skills",xx
Example 14: http://example.org/gov.uk/data/professions.csv
ProfessionFinanceInformation TechnologyOperational DeliveryPolicy
Example 15: http://example.org/senior-roles.csv
Post Unique Reference,Name,Grade,Job Title,Reports to Senior Post,Profession,Organization Reference90115,Steve Egan,SCS1A,Deputy Chief Executive,90334,Finance,hefce.ac.uk90334,Sir Alan Langlands,SCS4,Chief Executive,xx,Policy,hefce.ac.uk
Example 16: http://example.org/junior-roles.csv
Reporting Senior Post,Grade,Payscale Minimum (£),Payscale Maximum (£),Generic Job Title,Number of Posts (FTE),Profession,Organization Reference90115,4,17426,20002,Administrator,8.67,Operational Delivery,hefce.ac.uk90115,5,19546,22478,Administrator,0.5,Operational Delivery,hefce.ac.uk
Example 17: http://example.org/csv-metadata.json
{"@type":"TableGroup","@context":["http://www.w3.org/ns/csvw",{"@language":"en"}],"tables":[{"url":"gov.uk/data/organizations.csv","tableSchema":"gov.uk/schema/organizations.json","suppressOutput":true},{"url":"gov.uk/data/professions.csv","tableSchema":"gov.uk/schema/professions.json","suppressOutput":true},{"url":"senior-roles.csv","tableSchema":"gov.uk/schema/senior-roles.json"},{"url":"junior-roles.csv","tableSchema":"gov.uk/schema/junior-roles.json"}]}
Example 18: http://example.org/gov.uk/schema/organizations.json
{"@id":"http://example.org/gov.uk/schema/organizations.json","@context":"http://www.w3.org/ns/csvw","columns":[{"name":"ref","titles":"Organization Unique Reference","datatype":"string","required":true,"propertyUrl":"dc:identifier"},{"name":"name","titles":"Organization Name","datatype":"string","propertyUrl":"foaf:name"},{"name":"department","titles":"Department Reference","datatype":"string","null":"xx","propertyUrl":"org:subOrganizationOf","valueUrl":"http://example.org/organization/{department}"}],"primaryKey":"ref","aboutUrl":"http://example.org/organization/{ref}","foreignKeys":[{"columnReference":"department","reference":{"schemaReference":"http://example.org/gov.uk/schema/organizations.json","columnReference":"ref"}}]}
Example 19: http://example.org/gov.uk/schema/professions.json
{"@id":"http://example.org/gov.uk/schema/professions.json","@context":"http://www.w3.org/ns/csvw","columns":[{"name":"name","titles":"Profession","datatype":"string","required":true}],"primaryKey":"name"}
Example 20: http://example.org/gov.uk/schema/senior-roles.json
{"@id":"http://example.org/gov.uk/schema/senior-roles.json","@context":"http://www.w3.org/ns/csvw","columns":[{"name":"ref","titles":"Post Unique Reference","datatype":"string","required":true,"propertyUrl":"dc:identifier"},{"name":"name","titles":"Name","datatype":"string","aboutUrl":"http://example.org/organization/{organizationRef}/person/{_row}","propertyUrl":"foaf:name"},{"name":"grade","titles":"Grade","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/grade"},{"name":"job","titles":"Job Title","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/job"},{"name":"reportsTo","titles":"Reports to Senior Post","datatype":"string","null":"xx","propertyUrl":"org:reportsTo","valueUrl":"http://example.org/organization/{organizationRef}/post/{reportsTo}"},{"name":"profession","titles":"Profession","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/profession"},{"name":"organizationRef","titles":"Organization Reference","datatype":"string","propertyUrl":"org:postIn","valueUrl":"http://example.org/organization/{organizationRef}","required":true},{"name":"post_holder","virtual":true,"propertyUrl":"org:heldBy","valueUrl":"http://example.org/organization/{organizationRef}/person/{_row}"}],"primaryKey":"ref","aboutUrl":"http://example.org/organization/{organizationRef}/post/{ref}","foreignKeys":[{"columnReference":"reportsTo","reference":{"schemaReference":"http://example.org/gov.uk/schema/senior-roles.json","columnReference":"ref"}},{"columnReference":"profession","reference":{"schemaReference":"http://example.org/gov.uk/schema/professions.json","columnReference":"name"}},{"columnReference":"organizationRef","reference":{"schemaReference":"http://example.org/gov.uk/schema/organizations.json","columnReference":"ref"}}]}
Example 21: http://example.org/gov.uk/schema/junior-roles.json
{"@id":"http://example.org/gov.uk/schema/junior-roles.json","@context":"http://www.w3.org/ns/csvw","columns":[{"name":"reportsToSenior","titles":"Reporting Senior Post","datatype":"string","propertyUrl":"org:reportsTo","valueUrl":"http://example.org/organization/{organizationRef}/post/{reportsToSenior}","required":true},{"name":"grade","titles":"Grade","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/grade"},{"name":"min_pay","titles":"Payscale Minimum (£)","datatype":"integer","propertyUrl":"http://example.org/gov.uk/def/min_pay"},{"name":"max_pay","titles":"Payscale Maximum (£)","datatype":"integer","propertyUrl":"http://example.org/gov.uk/def/max_pay"},{"name":"job","titles":"Generic Job Title","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/job"},{"name":"number","titles":"Number of Posts (FTE)","datatype":"number","propertyUrl":"http://example.org/gov.uk/def/number_of_posts"},{"name":"profession","titles":"Profession","datatype":"string","propertyUrl":"http://example.org/gov.uk/def/profession"},{"name":"organizationRef","titles":"Organization Reference","datatype":"string","propertyUrl":"org:postIn","valueUrl":"http://example.org/organization/{organizationRef}","required":true}],"foreignKeys":[{"columnReference":"reportsToSenior","reference":{"schemaReference":"http://example.org/gov.uk/schema/senior-roles.json","columnReference":"ref"}},{"columnReference":"profession","reference":{"schemaReference":"http://example.org/gov.uk/schema/professions.json","columns":"name"}},{"columnReference":"organizationRef","reference":{"schemaReference":"http://example.org/gov.uk/schema/organizations.json","columns":"ref"}}]}
Note

This example makes extensive use of theexample.org domain. As described in [RFC6761], this domain is used for illustrative examples within documentation. In reality, the resources described here with the URL path/gov.uk would be centrally published by the UK Government at, say, the domaindata.gov.uk.

Given that these resources are centrally published with an aspiration for reuse, theschema descriptions have been factored out into separate resources. As such, the top-level metadata description resourcemetadata.json simply provides the list oftables and binds each of them to the appropriateschema that is defined elsewhere.

Finally, note that because the centrally published metadata descriptions are intended to be reused across many government departments and organizations, extra consideration has been given to defining URIs for theperson andpost resources defined in each row of the senior roles tabular data and subsequently referenced from the junior roles tabular data. To ensure that naming clashes are avoided, the unique reference for the organization to which theperson orpost belongs has been included in a path segment of the identifier. For example, theURI template propertyaboutUrl used to identify the seniorpost is specified ashttp://example.org/organization/{organizationRef}/post/{ref}, thus yielding the URIhttp://example.org/organization/hefce.ac.uk/post/90115 for thepost described in the firstrow of the senior roles tabular data.

Thegroup of tables generated from parsing the tabular data files and associated metadata is shown below and provides the basis for the conversion to JSON.

Annotations for thegroup of tablesG and the fourtablesTa,Tb,Tc, andTd are shown below:

Group of Tables annotations:

idcore annotations
tables
GTa,Tb,Tc,Td

Table annotations:

idcore annotations
urlcolumnsrowssuppress outputforeign keys
Tahttp://example.org/gov.uk/data/organizations.csvCa1,Ca2,Ca3Ra1,Ra2trueFa1
Tbhttp://example.org/gov.uk/professions.csvCb1Rb1,Rb2,Rb3,Rb4true
Tchttp://example.org/senior-roles.csvCc1,Cc2,Cc3,Cc4,Cc5,Cc6Rc1,Rc2falseFc1,Fc2,Fc3
Tdhttp://example.org/junior-roles.csvCd1,Cd2,Cd3,Cd4,Cd5,Cd6,Cd7Rd1,Rd2falseFd1,Fd2,Fd3
Note

In this example, output for the centrally published lists of organizations and professions, tablesTa andTb (http://example.org/gov.uk/data/organizations.csv andhttp://example.org/gov.uk/data/professions.csv respectively), are not required; only information from the departmental submissions is to be translated to RDF. Note thesuppress output annotation on thistable.

The following foreign keys are defined:

idcolumns in tablecolumns in referenced table
Fa1Ca3Ca1
Fc1Cc5Cc1
Fc2Cc6Cb1
Fc3Cc7Ca1
Fd1Cd1Cc1
Fd2Cd7Cb1
Fd3Cd8Ca1

Annotations for thecolumns,rows andcells intableT are shown in the tables below:

Column annotations:

idcore annotations
tablenumbersource numbercellsnametitlesrequiredvirtual
Ca1Ta11Ca1.1,Ca2.1refOrganization Unique Referencetrue
Ca2Ta11Ca1.2,Ca2.2nameOrganization Name
Ca3Ta11Ca1.3,Ca2.3departmentDepartment Reference
Cb1Tb11Cb1.1,Cb2.1,Cb3.1,Cb4.1nameProfessiontrue
Cc1Tc11Cc1.1,Cc2.1refPost Unique Referencetrue
Cc2Tc22Cc1.2,Cc2.2nameName
Cc3Tc33Cc1.3,Cc2.3gradeGrade
Cc4Tc44Cc1.4,Cc2.4jobJob Title
Cc5Tc55Cc1.5,Cc2.5reportsToReports to Senior Post
Cc6Tc66Cc1.6,Cc2.6professionProfession
Cc7Tc77Cc1.7,Cc2.7organizationRefOrganization Referencetrue
Cc8Tc88Cc1.8,Cc2.8post_holdertrue
Cd1Td11Cd1.1,Cd2.1reportsToSeniorReporting Senior Posttrue
Cd2Td22Cd1.2,Cd2.2gradeGrade
Cd3Td33Cd1.3,Cd2.3min_payPayscale Minimum (£)
Cd4Td44Cd1.4,Cd2.4max_payPayscale Maximum (£)
Cd5Td55Cd1.5,Cd2.5jobGeneric Job Title
Cd6Td66Cd1.6,Cd2.6numberNumber of Posts (FTE)
Cd7Td77Cd1.7,Cd2.7professionProfession
Cd8Td88Cd1.8,Cd2.8organizationRefOrganization Referencetrue
Note

ColumnCc8, with thevirtual annotation specified astrue, is used to relate theperson resource, whose name is provided incolumnCc2, to the associatedpost resource within the currentrow oftableTc ({ "url": "http://example.org/senior-roles.csv" }).

Row annotations:

idcore annotations
tablenumbersource numbercells
Ra1Ta12Ca1.1,Ca1.2,Ca1.3
Ra2Ta23Ca2.1,Ca2.2,Ca2.3
Rb1Tb12Cb1.1
Rb2Tb23Cb2.1
Rb3Tb34Cb3.1
Rb4Tb45Cb4.1
Rc1Tc12Cc1.1,Cc1.2,Cc1.3,Cc1.4,Cc1.5,Cc1.6,Cc1.7,Cc1.8
Rc2Tc23Cc2.1,Cc2.2,Cc2.3,Cc2.4,Cc2.5,Cc2.6,Cc2.7,Cc2.8
Rd1Td12Cd1.1,Cd1.2,Cd1.3,Cd1.4,Cd1.5,Cd1.6,Cd1.7,Cd1.8
Rd2Td23Cd2.1,Cd2.2,Cd2.3,Cd2.4,Cd2.5,Cd2.6,Cd2.7,Cd2.8

Cell annotations:

idcore annotations
tablecolumnrowstring valuevalueabout URLproperty URLvalue URL
Ca1.1TaCa1Ra1"hefce.ac.uk""hefce.ac.uk"<http://example.org/organization/hefce.ac.uk>dc:identifier
Ca1.2TaCa2Ra1"Higher Education Funding Council for England""Higher Education Funding Council for England"<http://example.org/organization/hefce.ac.uk>foaf:name
Ca1.3TaCa3Ra1"bis.gov.uk""bis.gov.uk"<http://example.org/organization/hefce.ac.uk>org:subOrganizationOf<http://example.org/organization/bis.gov.uk>
Ca2.1TaCa1Ra2"bis.gov.uk""bis.gov.uk"<http://example.org/organization/bis.gov.uk>dc:identifier
Ca2.2TaCa2Ra2"Department for Business, Innovation and Skills""Department for Business, Innovation and Skills"<http://example.org/organization/bis.gov.uk>foaf:name
Ca2.3TaCa3Ra2"xx"null<http://example.org/organization/bis.gov.uk>org:subOrganizationOf
Cb1.1TbCb1Rb1"Finance""Finance"
Cb2.1TbCb1Rb2"Information Technology""Information Techology"
Cb3.1TbCb1Rb3"Operational Delivery""Operational Delivery"
Cb4.1TbCb1Rb4"Policy""Policy"
Cc1.1TcCc1Rc1"90115""90115"<http://example.org/organization/hefce.ac.uk/post/90115>dc:identifier
Cc1.2TcCc2Rc1"Steve Egan""Steve Egan"<http://example.org/organization/hefce.ac.uk/person/1>foaf:name
Cc1.3TcCc3Rc1"SCS1A""SCS1A"<http://example.org/organization/hefce.ac.uk/post/90115><http://example.org/gov.uk/def/grade>
Cc1.4TcCc4Rc1"Deputy Chief Executive""Deputy Chief Executive"<http://example.org/organization/hefce.ac.uk/post/90115><http://example.org/gov.uk/def/job>
Cc1.5TcCc5Rc1"90334""90334"<http://example.org/organization/hefce.ac.uk/post/90115>org:reportsTo<http://example.org/organization/hefce.ac.uk/post/90334>
Cc1.6TcCc6Rc1"Finance""Finance"<http://example.org/organization/hefce.ac.uk/post/90115><http://example.org/gov.uk/def/profession>
Cc1.7TcCc7Rc1"hefce.ac.uk""hefce.ac.uk"<http://example.org/organization/hefce.ac.uk/post/90115>org:postIn<http://example.org/organization/hefce.ac.uk>
Cc1.8TcCc8Rc1""null<http://example.org/organization/hefce.ac.uk/post/90115>org:heldBy<http://example.org/organization/hefce.ac.uk/person/1>
Cc2.1TcCc1Rc2"90334""90334"<http://example.org/organization/hefce.ac.uk/post/90334>dc:identifier
Cc2.2TcCc2Rc2"Sir Alan Langlands""Sir Alan Langlands"<http://example.org/organization/hefce.ac.uk/person/2>foaf:name
Cc2.3TcCc3Rc2"SCS4""SCS4"<http://example.org/organization/hefce.ac.uk/post/90334><http://example.org/gov.uk/def/grade>
Cc2.4TcCc4Rc2"Chief Executive""Chief Executive"<http://example.org/organization/hefce.ac.uk/post/90334><http://example.org/gov.uk/def/job>
Cc2.5TcCc5Rc2"xx"null<http://example.org/organization/hefce.ac.uk/post/90334>org:reportsTo
Cc2.6TcCc6Rc2"Policy""Policy"<http://example.org/organization/hefce.ac.uk/post/90334><http://example.org/gov.uk/def/profession>
Cc2.7TcCc7Rc2"hefce.ac.uk""hefce.ac.uk"<http://example.org/organization/hefce.ac.uk/post/90334>org:postIn<http://example.org/organization/hefce.ac.uk>
Cc2.8TcCc8Rc2""null<http://example.org/organization/hefce.ac.uk/post/90334>org:heldBy<http://example.org/organization/hefce.ac.uk/person/2>
Cd1.1TdCd1Rd1"90115""90115"org:reportsTo<http://example.org/organization/hefce.ac.uk/post/90115>
Cd1.2TdCd2Rd1"4""4"<http://example.org/gov.uk/def/grade>
Cd1.3TdCd3Rd1"17426"17426<http://example.org/gov.uk/def/min_pay>
Cd1.4TdCd4Rd1"20002"20002<http://example.org/gov.uk/def/max_pay>
Cd1.5TdCd5Rd1"Administrator""Administrator"<http://example.org/gov.uk/def/job>
Cd1.6TdCd6Rd1"8.67"8.67<http://example.org/gov.uk/def/number_of_posts>
Cd1.7TdCd7Rd1"Operational Delivery""Operational Delivery"<http://example.org/gov.uk/def/profession>
Cd1.8TdCd8Rd1"hefce.ac.uk""hefce.ac.uk"org:postIn<http://example.org/organization/hefce.ac.uk>
Cd2.1TdCd1Rd2"90115""90115"org:reportsTo<http://example.org/organization/hefce.ac.uk/post/90115>
Cd2.2TdCd2Rd2"5""5"<http://example.org/gov.uk/def/grade>
Cd2.3TdCd3Rd2"19546"19546<http://example.org/gov.uk/def/min_pay>
Cd2.4TdCd4Rd2"22478"22478<http://example.org/gov.uk/def/max_pay>
Cd2.5TdCd5Rd2"Administrator""Administrator"<http://example.org/gov.uk/def/job>
Cd2.6TdCd6Rd2"0.5"0.5<http://example.org/gov.uk/def/number_of_posts>
Cd2.7TdCd7Rd2"Operational Delivery""Operational Delivery"<http://example.org/gov.uk/def/profession>
Cd2.8TdCd8Rd2"hefce.ac.uk""hefce.ac.uk"org:postIn<http://example.org/organization/hefce.ac.uk>
Note

Notice thatvalue URL is not specified forcellsCa2.3 andCc2.5 because in each case thecell value isnull and thevirtual annotation ofcolumnCb5 isnot defined.

Minimal mode output for this example is provided below:

Example 22: http://example.org/public-sector-roles-and-salaries-minimal.json
[{"@id":"http://example.org/organization/hefce.ac.uk/post/90115","dc:identifier":"90115","org:heldBy":{"@id":"http://example.org/organization/hefce.ac.uk/person/1","foaf:name":"Steve Egan"},"http://example.org/gov.uk/def/grade":"SCS1A","http://example.org/gov.uk/def/job":"Deputy Chief Executive","org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90334","http://example.org/gov.uk/def/profession":"Finance","org:postIn":"http://example.org/organization/hefce.ac.uk"},{"@id":"http://example.org/organization/hefce.ac.uk/post/90334","dc:identifier":"90334","org:heldBy":{"@id":"http://example.org/organization/hefce.ac.uk/person/2","foaf:name":"Sir Alan Langlands"},"http://example.org/gov.uk/def/grade":"SCS4","http://example.org/gov.uk/def/job":"Chief Executive","http://example.org/gov.uk/def/profession":"Policy","org:postIn":"http://example.org/organization/hefce.ac.uk"},{"org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90115","http://example.org/gov.uk/def/grade":"4","http://example.org/gov.uk/def/min_pay":17426,"http://example.org/gov.uk/def/max_pay":20002,"http://example.org/gov.uk/def/job":"Administrator","http://example.org/gov.uk/def/number_of_posts":8.67,"http://example.org/gov.uk/def/profession":"Operational Delivery","org:postIn":"http://example.org/organization/hefce.ac.uk"},{"org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90115","http://example.org/gov.uk/def/grade":"5","http://example.org/gov.uk/def/min_pay":19546,"http://example.org/gov.uk/def/max_pay":22478,"http://example.org/gov.uk/def/job":"Administrator","http://example.org/gov.uk/def/number_of_posts":0.5,"http://example.org/gov.uk/def/profession":"Operational Delivery","org:postIn":"http://example.org/organization/hefce.ac.uk"}]
Note

Prefixes defined within theRDFa 1.1 Initial Context ([rdfa-core]) are not expanded; e.g.dc: for <http://purl.org/dc/terms/>.

Output fortablesTa andTb ({ "url": "http://example.org/gov.uk/data/organizations.csv" } and{ "url": "http://example.org/gov.uk/data/professions.csv" }) are not included as thesuppress output annotation has the valuetrue for each of thetables.

Theproperty URL is specified for allcells intablesTc andTd.

ColumnsCc5 andCd1 ({ "name": "reportsTo" } and{ "name": "reportsToSenior" }) use theabout URL,property URL andvalue URL annotations to assert the relationship between the post described by a givenrow and the senior post to which it reports. However, since senior posts and junior posts are described in different tables it is not possible to create nestedobjects for this particular case.

Similarly,columnsCc7 andCd8 (both with{ "name": "organizationRef" }) use theabout URL,property URL andvalue URL annotations to assert the relationship between the post described by a givenrow and the organization to which it belongs.

Finally, note that two resources are created for eachrow withintableTc ({ "url": "http://example.org/senior-roles.csv" }): theperson and thepost they occupy. The relationship between these resources is specified viavirtualcolumnCc8 ({ "name": "post_holder" }) using theabout URL,property URL andvalue URL annotations. Thepersonobject provides the value of the name-value pair with correspondingnameorg:heldBy, thus nesting thepersonobject within thepostobject.

Standard mode output for this example is provided below:

Example 23: http://example.org/public-sector-roles-and-salaries-standard.json
{"tables":[{"url":"http://example.org/senior-roles.csv","row":[{"url":"http://example.org/senior-roles.csv#row=2","rownum":1,"describes":[{"@id":"http://example.org/organization/hefce.ac.uk/post/90115","dc:identifier":"90115","org:heldBy":{"@id":"http://example.org/organization/hefce.ac.uk/person/1","foaf:name":"Steve Egan"},"http://example.org/gov.uk/def/grade":"SCS1A","http://example.org/gov.uk/def/job":"Deputy Chief Executive","org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90334","http://example.org/gov.uk/def/profession":"Finance","org:postIn":"http://example.org/organization/hefce.ac.uk"}]},{"url":"http://example.org/senior-roles.csv#row=3","rownum":2,"describes":[{"@id":"http://example.org/organization/hefce.ac.uk/post/90334","dc:identifier":"90334","org:heldBy":{"@id":"http://example.org/organization/hefce.ac.uk/person/2","foaf:name":"Sir Alan Langlands"},"http://example.org/gov.uk/def/grade":"SCS4","http://example.org/gov.uk/def/job":"Chief Executive","http://example.org/gov.uk/def/profession":"Policy","org:postIn":"http://example.org/organization/hefce.ac.uk"}]}]},{"url":"http://example.org/junior-roles.csv","row":[{"url":"http://example.org/junior-roles.csv#row=2","rownum":1,"describes":[{"org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90115","http://example.org/gov.uk/def/grade":"4","http://example.org/gov.uk/def/min_pay":17426,"http://example.org/gov.uk/def/max_pay":20002,"http://example.org/gov.uk/def/job":"Administrator","http://example.org/gov.uk/def/number_of_posts":8.67,"http://example.org/gov.uk/def/profession":"Operational Delivery","org:postIn":"http://example.org/organization/hefce.ac.uk"}]},{"url":"http://example.org/junior-roles.csv#row=3","rownum":2,"describes":[{"org:reportsTo":"http://example.org/organization/hefce.ac.uk/post/90115","http://example.org/gov.uk/def/grade":"5","http://example.org/gov.uk/def/min_pay":19546,"http://example.org/gov.uk/def/max_pay":22478,"http://example.org/gov.uk/def/job":"Administrator","http://example.org/gov.uk/def/number_of_posts":0.5,"http://example.org/gov.uk/def/profession":"Operational Delivery","org:postIn":"http://example.org/organization/hefce.ac.uk"}]}]}]}

A.Acknowledgements

At the time of publication, the following individuals had participated in the Working Group, in the order of their first name: Adam Retter, Alf Eaton, Anastasia Dimou, Andy Seaborne, Axel Polleres, Christopher Gutteridge, Dan Brickley, Davide Ceolin, Eric Stephan, Erik Mannens, Gregg Kellogg, Ivan Herman, Jeni Tennison, Jeremy Tandy, Jürgen Umbrich, Rufus Pollock, Stasinos Konstantopoulos, William Ingram, and Yakov Shafranovich.

B.Changes since previous versions

B.1Changes since candidate recommendation of 16 July 2015

B.2Changes since the working draft of 16 April 2015

B.3Changes since the first public working draft of 08 January 2015

The document has undergone substantial changes since thefirst public working draft. Below are some of the changes made:

C.References

C.1Normative references

[RFC2119]
S. Bradner.Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL:https://tools.ietf.org/html/rfc2119
[RFC7159]
T. Bray, Ed..The JavaScript Object Notation (JSON) Data Interchange Format. March 2014. Proposed Standard. URL:https://tools.ietf.org/html/rfc7159
[csv2rdf]
Jeremy Tandy; Ivan Herman; Gregg Kellogg.Generating RDF from Tabular Data on the Web. W3C Recommendation. URL:http://www.w3.org/TR/2015/REC-csv2rdf-20151217/
[rdf11-concepts]
Richard Cyganiak; David Wood; Markus Lanthaler.RDF 1.1 Concepts and Abstract Syntax. 25 February 2014. W3C Recommendation. URL:http://www.w3.org/TR/rdf11-concepts/
[tabular-data-model]
Jeni Tennison; Gregg Kellogg.Model for Tabular Data and Metadata on the Web. W3C Recommendation. URL:http://www.w3.org/TR/2015/REC-tabular-data-model-20151217/
[tabular-metadata]
Jeni Tennison; Gregg Kellogg.Metadata Vocabulary for Tabular Data. W3C Recommendation. URL:http://www.w3.org/TR/2015/REC-tabular-metadata-20151217/

C.2Informative references

[Knuth]
The Art of Computer Programming Volume 1: Fundamental Algorithms (3rd ed.).
[RFC6761]
S. Cheshire; M. Krochmal.Special-Use Domain Names. February 2013. Proposed Standard. URL:https://tools.ietf.org/html/rfc6761
[RFC7111]
M. Hausenblas; E. Wilde; J. Tennison.URI Fragment Identifiers for the text/csv Media Type. January 2014. Informational. URL:https://tools.ietf.org/html/rfc7111
[UAX15]
Mark Davis; Ken Whistler.Unicode Normalization Forms. 31 August 2012. Unicode Standard Annex #15. URL:http://www.unicode.org/reports/tr15
[json-ld]
Manu Sporny; Gregg Kellogg; Markus Lanthaler.JSON-LD 1.0. 16 January 2014. W3C Recommendation. URL:http://www.w3.org/TR/json-ld/
[rdfa-core]
Ben Adida; Mark Birbeck; Shane McCarron; Ivan Herman et al.RDFa Core 1.1 - Third Edition. 17 March 2015. W3C Recommendation. URL:http://www.w3.org/TR/rdfa-core/

[8]ページ先頭

©2009-2025 Movatter.jp