Skip to content

Latest commit

 

History

History
140 lines (103 loc) · 5.66 KB

import.md

File metadata and controls

140 lines (103 loc) · 5.66 KB

⚠ Important: glossarify-md is able to import terms and definitions from a remote location using https, when configured this way. It will try to remove any Markdown and HTML from imported data using strip-markdown. Nevertheless, as a rule of thumb, never blindly import from untrusted sources.

Loading files from a remote location could enable a remote entity to embed malicious code, execute such code in the runtime context of glossarify-md or make glossarify-md embed it into your output files. Consider downloading files first and after review import them statically from within your project.

Since v7.0.0

CSV is a textual serialization for tabular data and supported by most spreadsheed programmes. Columns in CSV are separated by a delimiter.

Example: CSV formatted tabular data delimited by ; and without a header row

#123;IGNORED-COLUMN;My Term;Alternative Term;This Term stands for Foo

Without a header row embedded into the CSV data a schema mapping is required to tell glossarify-md where to find glossary columns (resp. fields):

{
  "...": "..."
  "glossaries": [{
    "uri": "http://your-domain.com/vocab/#",
    "file": "./glossary.md",
    "import": {
      "file": "./terms.csv",
      "dialect": {
        "delimiter": ";",
        "doubleQuotes": true
      },
      "schema": {
        "fields": [
            { "name": "@id"},
            { "name": "" },
            { "name": "http://www.w3.org/2004/02/skos/core#prefLabel" },
            { "name": "http://www.w3.org/2004/02/skos/core#altLabel" },
            { "name": "http://www.w3.org/2004/02/skos/core#definition" }
        ]
    }
  }
}]

A schema mapping can be omitted when the CSV file embeds these as header labels in the first row:

Example: CSV with a header row

@id;http://www.w3.org/2004/02/skos/core#prefLabel;http://www.w3.org/2004/02/skos/core#altLabel;http://www.w3.org/2004/02/skos/core#definition

#123;My Term;Alternative Term;This Term stands for Foo

Since v6.0.0

{
  "glossaries": [{
    "file": "./glossary.md",
    "import": {
      "file": "./terms.json"
    }
  }]
}

In contrast to importing from a JSON file which was exported by glossarify-md itself, importing from arbitrary data models and JSON serializations is likely to require mappings onto SKOS 🌎 types. Have a look at glossarify-md's own JSON export format to see how it maps format-specific attribute and type names onto SKOS properties and concepts. See Interoperability with SKOS and JSON-LD 🌎 for an in-depth example.

{
  "glossaries": [{
    "file": "./glossary.md",
    "import": {
      "file": "./terms.json",
      "context": "./mapping.jsonld"
    }
  }]
}

Since v6.0.0

Glossary terms can also be imported from RDF serializations when the RDF triples refer to supported SKOS 🌎 concepts and properties. Supported RDF serializations are N-Triples, N-Quads or JSON-LD 🌎.

  • Importing N-Triples/N-Quads requires the file name to end with .nq
  • Importing from JSON-LD 🌎 requires the file name to end with .jsonld
    • For an example on how to import from JSON-LD 🌎 have a look at glossarify-md's own JSON export format to see how it maps format-specific attribute and type names onto SKOS 🌎 properties and concepts. See also Interoperability with SKOS and JSON-LD for an in-depth example.

Example: Import RDF + SKOS 🌎 from an N-Quads serialization:

{
  "glossaries": [{
    "file": "./glossary.md",
    "import": {
      "file": "./terms.nq"
    }
  }]
}