Voc2Skos

 

The Voc2Skos feature allows to convert a CSV text file into SKOS.  This functionality is enabled when you select the "voc2skos" format in the "Upload Ontology" wizard sequence.

A simple example of a CSV contents suitable for conversion is as follows (spaces added for clarity):

ID             ,skos:prefLabel ,skos:definition           ,myProperty 
conceptA       ,concept A      ,concept A definition      ,my value for concept A
conceptB       ,concept B      ,concept B definition      ,my value for concept B
conceptC       ,concept C      ,concept C definition      ,my value for concept C

A more complete example showing how to indicate the desired concept class and a hierarchy of concepts (among other parameters) is as follows:

# lines starting with a hash (#) are ignored
ontologyURI = "<a href="http://example.org/myont"
class">http://example.org/myont"
class</a> = "Foo"
skos:prefLabel = "My preferred label for Foo"
skos:definition = "This is a demo skos:definition for concept Foo"
indent.string = "  "
indent.property = skos:narrower
ID             ,skos:prefLabel ,skos:definition           ,myProperty 
conceptA       ,concept A      ,concept A definition      ,my value for concept A
  conceptA1    ,concept A1     ,concept A1 definition     ,my value for concept A1
    conceptA1a ,concept A1a    ,concept A1a definition    ,my value for concept A1a
    conceptA1b ,concept A1b    ,concept A1b definition    ,my value for concept A1b
  conceptA2    ,concept A2     ,concept A2 definition     ,my value for concept A2
conceptB       ,concept B      ,concept B definition      ,my value for concept B
  conceptB1    ,concept B1     ,concept B1 definition     ,my value for concept B1
conceptC       ,concept C      ,concept C definition      ,my value for concept C

 

The latter example includes a preamble section specifying certain elements for the SKOS vocabulary to be created:

  • ontologyURI: URI for the ontology and namespace for its terms. By default, an ad hoc URI is assigned. In the example: http://example.org/myont.
  • class: Local name for the concept class. In the example: Foo.
  • Properties for the class. Well-known properties can be indicated with their typical denotation, including skos:prefLabel, skos:definition, skos:altLabel, rdfs:label, rdfs:comment, etc.
  • indent.string: String defining the hierarchical structure for the terms according to the indentation level determined by this string in the first column. By default, indentation is ignored. In the example: "  " (two spaces).
  • indent.property: The SKOS relation property to use between the parent and the child in the hierarchy. By default, skos:narrower. Processed only when a non-empty indent.string is indicated. In the example: skos:narrower (explicitly indicated).
  • separator: The separator character for the CSV contents that follows after the preamble. By default, comma (","). Not given in the example.

The actual CSV contents defining the terms come after the preamble:

The columns in the header line indicate:

  • first column: If the column name is "URI", then the values in this column are used exactly as given for the URIs for the terms. Otherwise, the value is used along with the namespace (ontologyURI) to compose the term URI. In the example, the first column is named "ID" so, the term URIs will have the form http://example.org/myont/conceptX for each value conceptX in this column.
  • subsequent columns indicate the properties to be associated with each term.   Well-known properties, eg., skos:preLabel, can be used, but others can be defined as well (eg., myProperty in the examples above).

Subsequent lines define the terms themselves, with columns containing the values corresponding to the specification in the header.