DataFormats exam preparation

This document was written by Mikoláš Fromm and contains a sum-up of all topics covered in NPRG036.

Intro

Levels of data

Conceptual domain model

Answers the following questions:

Example: UML

Data models vs. formats vs. schemas

Models = logical view of data

Formats = physical view of data

Schemas = annotations and constraints applicable to instances of data formats. For better description and validation.

Some formats might be used as metaformats for other formats. Such as JSON is meta for GeoJSON, RDF for DCAT, XML for SVG etc...

Open vs. Closed formats

Machine-readable formats

Binary vs. text based formats

Standardization - authorities

  1. working draft (WD)
  2. candidate recommendation (CR)
  3. proposed recommendation (PR)
  4. W3C recommendation (REC)

RFC keywords

  1. MUST, REQUIRED, SHALL
    An absolute requirement

  2. MUST NOT, SHALL NOT
    An absolute prohibition

  3. SHOULD, RECOMMENDED
    May exist reasons to ignore

  4. SHOULD NOT, NOT RECOMMENDED
    May exist reasons to implement

Identifiers

Graph data formats

RDF

my:staff/85740 my:hasAdress _:a1 .
_:a1 my:street "Františka Lenocha 1" .
_:a1 my:city "Prague" .
_:a1 my:zipCode "11000" .

RDF - serialization

N-Triples

Turtle

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix my: <http://example.com/> .
my:index.html dcterms:created "2020-04-23"^^xsd:date  .
@prefix foo: <http://example.org/ns#> .
@base <http://newbase.com/> .

<#document> foo: <https://jk.com> .

is equivalent with:

<http://newbase.com/#document> <http://example.org/ns#> <https://jk.com> .

@base <http://example.org/ns/> . (base = http://example.org/ns/)
@base <foo/> . (base = http://example.org/ns/foo/)
@prefix : <bar#> . (: = http://example.org/ns/foo/bar#)
"""a string
with newlines
"""
base <http://www.w3.org/People/> .
@prefix : <http://xmlns.com/foaf/0.1/> .

# default graph
{
     ericFoaf:ericP :givenName "Eric" .
}

# also default graph, no {}
ericFoaf:ericP :givenName "Eric" .

# graph highlight
GRAPH <Eric/ericP-foaf.rdf> {
	ericFoaf:ericP :givenName "Eric" .
}

RDF Schema

ex:MotorVehicle       rdf:type          rdfs:Class .
ex:Van                rdf:type          rdfs:Class .

ex:PassengerVehicle   rdfs:subClassOf   ex:MotorVehicle .
ex:Van                rdfs:subClassOf   ex:MotorVehicle .

ex:MiniVan            rdfs:subClassOf   ex:Van .
ex:Person   rdf:type     rdfs:Class .
ex:author   rdf:type     rdf:Property . ## means that author is a property
ex:author   rdfs:range   ex:Person . ## means that each author is of type ex:Person

ex:hasMother   rdf:type      rdf:Property .
ex:hasMother   rdfs:range    ex:Female .
ex:hasMother   rdfs:domain   ex:Person . ## means that every Person has a mother

World Wide Web

5 star principle

Alt text

SPARQL

<http://example.com/index.html> <http://purl.org/dc/terms/creator> <http://example.com/staff/8574> .
?s                              <http://purl.org/dc/terms/creator> <http://example.com/staff/8574> .
?stud rdf:type sis:Person ;
      sis:name ?name ; 
      sis:age ?age .
?stud sis:name ?name ; 
      sis:age ?age .
OPTIONAL { 
      ?stud rdf:type ?type. 
}
PREFIX sis: <http://is.cuni.cz/studium/sis#>
SELECT ?name ?age
WHERE {
  ?stud a ?type ;
      sis:name ?name ; 
      sis:age  ?age .
    
  FILTER (?age > 27)
}
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?g
WHERE {
    GRAPH ?g {

        ?s a foaf:Person .

    }
}
SELECT ?check ?fine ?higher
WHERE {
  ?check a schema:CheckAction ;
     schema:result/schema:result/gr:hasCurrencyValue ?fine .
  BIND(IF(?fine > 1000, true, false) AS ?higher)
} 
LIMIT 100

Common RDF Vocabularies

Dublin Core

SKOS

Good Relations

  1. Agent gr:BusinessEntity
  2. Object or Service gr:ProductOrService
  3. Promise gr:Offering
  4. Location gr:Location

Schema.org

WikiData

Labeled Property Graph (LPG)

Create statements

CREATE (:Person {name: 'James'})-[:FOLLOWS]->(:Person {name: 'John'})

Queries

MATCH
     (p1:Person)-[:USES]->(c:Camera)<-[:OWNS]-(p2:Person)<-[:FOLLOWS]-(p1:Person)
RETURN
     p1
//Find James’s camera
MATCH // matches all types that have the same structure
  (c:Camera)<-[:OWNS]-(p:Person)
WHERE // typical conditioning
  p.name = 'James'
SET // changing the output
  c.condition = 'used'
RETURN
  c
MERGE (p:Person {name: 'James'}) // will only be created if James doesn't exist yet
  ON CREATE SET // only when object was created
    p.twitter = '@james'
MERGE (p)-[:OWNS]->(:Laptop {vendor: 'Dell'})
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
RETURN p.name, count(*) AS numberOfMovies // is grouped by name, aggregation is count(*)
MATCH (david {name: 'David'})--(otherPerson)-->()
WITH otherPerson, count(*) AS foaf
WHERE foaf > 1
RETURN otherPerson.name
// Names of people (otherPerson) connected to David, who have more than 1 outgoing connections.
LOAD CSV WITH HEADERS FROM 'file:///orders.csv' AS row
WITH toInteger(row.orderID) AS orderId, // toInteger() otherwise everything is string
  row.`ship country` AS country // because of "WITH HEADERS", the column names are recognized
MERGE (o:Order {orderId: orderId})
  SET o.shipCountry = country
RETURN count(o);

RDF vs LPG

RDF LPG
global identification local node labels & edge types
globally reused RDF vocabs relationship types and node labels always different
focused on linking data of various publishers focused on evaluating graph algorithms

Hierarchical data formats

XML

Document oriented XML

<?xml version="1.0" encoding="UTF-8"?>
<message>
Dear <customer><firstName>John</firstName> <lastName>Doe</lastName></customer>,

the balance on your bank account <accountNumber>111333444/1123</accountNumber> as of <balanceDate>3rd of January 2021</balanceDate> is <balance><value>25000</value> <currency>CZK</currency></balance>.

Best regards,

<bankName>Your bank</bankName>
<streetAddress>1234 5th Avenue</streetAddress>
<phone>+420123456789</phone>
</message>

Data oriented XML

<?xml version="1.0" encoding="UTF-8"?>
<catalog>
    <title>My catalog</title>
    <description>This is my dummy catalog</description>
    <contact-point>
        <name>John Doe</name>
        <e-mail>mailto:john@doe.org</e-mail>
    </contact-point>
    <datasets>
        <dataset>
            <title>My first dataset</title>
        </dataset>
        <dataset>
            <title>My second dataset</title>
        </dataset>
    </datasets>
</catalog>

XML Well-formedness

XML namespaces

<root xmlns:h="http://www.w3.org/TR/html4/"
      xmlns:f="https://www.w3schools.com/furniture">
  <h:table>
    <h:tr>
      <h:td>Apples</h:td>
      <h:td>Bananas</h:td>
    </h:tr>
  </h:table>
  <f:table>
    <f:name>African Coffee Table</f:name>
    <f:width>80</f:width>
    <f:length>120</f:length>
  </f:table>
</root>

XML language specification (xml:lang)

<?xml version="1.1" encoding="UTF-8"?>
<document>
    <p xml:lang="en">The quick brown fox jumps over the lazy dog.</p>
    <p xml:lang="en-GB">What colour is it?</p>
    <p xml:lang="en-US">What color is it?</p>
    <sp who="Faust" desc='leise' xml:lang="de">
        <l>Habe nun, ach! Philosophie,</l>
        <l>Juristerei, und Medizin</l>
        <l>und leider auch Theologie</l>
        <l>durchaus studiert mit heißem Bemüh'n.</l>
    </sp>
</document>

XML processing instruction (PI)

<?xml-stylesheet type="text/xsl" href="style.xsl"?>

XML entities

< &lt;
> &gt;
& &amp;
' &apos;
" &quot;

< &#60; - decimal
< &#x3C; - hexadecimal

Example usage

<consumers>
    <consumer>
        <name>John</name>
        <age>20</age>
        <coffees-per-day>2</coffees-per-day>
    </consumer>
    <consumer>
        <name>Jane</name>
        <age>18</age>
        <coffees-per-day>1</coffees-per-day>
    </consumer>
    <consumer>
        <name>Steve</name>
        <age>31</age>
        <coffees-per-day>5</coffees-per-day>
    </consumer>
</consumers>
<Companies>
    <Company>
        <Identifier recorded="2014-11-05">3543609</Identifier>
        <Address type="HQ" recorded="2014-11-05">
            <countryName>Česká republika</countryName>
            <city>Brno</city>
            <partOfCity>Bohunice</partOfCity>
            <street>Neužilova</street>
            <descNumber>201</descNumber>
            <orNumber>35</orNumber>
            <zip>62500</zip>
            <region>Brno-město</region>         
        </Address>
    </Company>
</Companies>

Processing XML

Document object model (DOM)
XPath /consumers/consumer[1]/name
Simple API for XML (SAX)
Element start (name = "consumers")
Element start (name = "consumer")
Element start (name = "name")
Text value (value = "John")
.
.
.

XML Syntax (RDF/XML)

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
   xmlns:dcterms="http://purl.org/dc/terms/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
  <rdf:Description rdf:about="http://example.com/index.html">
    <dcterms:subject xml:lang="en">Education</dcterms:subject>
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Page"/>
  </rdf:Description>
</rdf:RDF>
<rdf:RDF >
    <rdf:Description rdf:about="SubjectResource">
        <PredicateResource rdf:nodeID="BlankNode"/>
    </rdf:Description>
    <rdf:Description rdf:nodeID="BlankNode"></rdf:Description></rdf:RDF>

XML Schema

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  ... <!-- XML schema definition  --></xs:schema>

<?xml version="1.0" encoding="utf-8"?>
<root_element_of_XML_document
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="schema2.xsd">
  ... <!-- XML document --></root_element_of_XML_document>

XML Validation

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Catalog"/>
</xs:schema>

valid

<?xml version="1.0" encoding="UTF-8"?>
<Catalog 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="Schema01.xsd"
    >
        <Dataset>
            <test/>
        </Dataset>
    </Catalog>
<?xml version="1.0" encoding="UTF-8"?>
<Catalog 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="Schema01.xsd"
    />

not valid

<?xml version="1.0" encoding="UTF-8"?>
<Catalog1 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="Schema01.xsd"
    />
simpleType & complexType
Namespacing

schema schema.xsd

<xs:schema 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tempuri.org/" 
elementFormDefault="qualified">
  <xs:element name="Add">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="intA" 
                    type="xs:int"/>
        <xs:element name="intB" 
                    type="xs:int"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

document document.xml

<?xml version="1.0" encoding="UTF-8"?>
<n1:Add 
xmlns:n1="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tempuri.org/ schema.xsd">
  <n1:intA>1</n1:intA>
  <n1:intB>3</n1:intB>
</n1:Add>
  1. qualified
  2. unqualified
schema.xsd
<xs:element name="intA" type="xs:int"
          form="unqualified"/>
<xs:element name="intB" type="xs:int"
          form="qualified"/>

document.xml
<intA>1</intA>
<n1:intB>3</n1:intB>

Xpath

XPath Data Model

Xpath examples

absolute path:

/catalog/datasets/dataset/title

access function:

/catalog/datasets/dataset/title/text()

access attribute

/catalog/datasets/dataset/title/@xml:lang

filter with predicate

/catalog/datasets/dataset/title[@xml:lang="en"]/text()

relative path -> is taken from the current position

title[@xml:lang="en"]/text()

axes:

axis::node-test [predicate1] ... [predicateN]

child: (contains all child elements only)
/child::catalog/child::datasets

descendant: (contains all elements in the subtree)
/catalog/descendant::*

attribute: (contains all attributes in the subtree)
/catalog/descendant::*/@*

preceding-sibling: (contain a preceding sibling of the node)
/catalog/title/preceding-sibling::title/text()

descendant-or-self: (contains all current or descendant elements)
/catalog//title

functions:

name() - returns the name of the element
/catalog/datasets/name()

position() - returns the position in the parent
/catalog/datasets/dataset/position()

last() - returns the last position in the parent
/catalog/datasets/dataset[last()]
Common errors
/rental[state="Hawaii"]/offer/car[type="cabrio"]
vs.
/rental[state="Hawaii" and offer/car[type="cabrio"]]
//section[last()] 
/descendant-or-self::node()/section[last()] (: returns end section of each chapter :)
vs.
/descendant::section[last()] (:returns last section:)

XSL Transformations - XSLT

empty stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions">
    
    <xsl:output method="html" encoding="UTF-8" indent="yes" />
    
</xsl:stylesheet>

Examples

first example: selecting informations via xsl:value-of

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions">

    <xsl:output method="html" encoding="UTF-8" indent="yes" />
    <xsl:template match="catalog">
        <html>
            <head>
                <title>
                    <xsl:value-of select="title[@xml:lang='en']"/>
                </title>
            </head>
            <body>
                <h1>
                    <xsl:value-of select="title[@xml:lang='en']"/>
                </h1>
            </body>
        </html>
    </xsl:template>
    
</xsl:stylesheet>
<html xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>My catalog</title>
    </head>
    <body>
        <h1>My catalog</h1>
    </body>
</html>

second example

<!-- gets applied only to selected elements -->
<xsl:apply-templates select="datasets/dataset">

Implicit templates

The following templates are implicitly in XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   xmlns:fn="http://www.w3.org/2005/xpath-functions">

    <!-- match all elements and its children -->
    <xsl:template match="*|/">
        <xsl:apply-templates/>
    </xsl:template>

    <!-- match all text content of elements -->
    <xsl:template match="text()|@*">
        <xsl:value-of select="."/>
    </xsl:template>

    <!-- match all instructions and comments -->
    <xsl:template match="processing-instruction()|comment()"/>
</xsl:stylesheet>

therefore explicit override of the implicit template is needed:

<xsl:template match="text()"/>

Templates can be also named and have parameters:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="html" encoding="UTF-8" indent="yes" />

    <!-- matches the dataset and passes the correct arguments -->
    <xsl:template match="dataset">
        <xsl:call-template name="processTitle">
            <xsl:with-param name="element">h2</xsl:with-param>
            <xsl:with-param name="lang">en</xsl:with-param>
        </xsl:call-template>
    </xsl:template>

    <!-- generic definition with two arguments, element and lang -->
    <xsl:template name="processTitle">
        <xsl:param name="element" required="yes"/>
        <xsl:param name="lang" required="yes"/>
        <xsl:element name="{$element}">
            <xsl:value-of select="title[@xml:lang=$lang]"/>
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>

JSON

Example usage

JSON Lines
JSON Pointer

JSON Schema

Basic validation

having the following file:

{
    "productId": 1,
    "productName": "A green door",
    "price": 12.5,
    "tags": [ "home", "green" ],
    "dimensions": {
        "length": 7.0,
        "width": 12.0,
        "height": 9.5
    }
}

the schema might look like:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "http://example.com/product.schema.json",
    "title": "Product",
    "description": "A product from Acme's catalog",
    "type": "object",
    "properties": {
          "productId": {
               "description": "The unique identifier for a product",
               "type": "integer"
          },
          "productName": {
               "description": "Name of the product",
               "type": "string"
          },
          "price": {
               "description": "The price of the product",
               "type": "number",
               "exclusiveMinimum": 0
          },
          "tags": {
               "description": "Tags for the product",
               "type": "array",
               "items": {
                    "type": "string"
               },
               "minItems": 1,
               "uniqueItems": true
          },
          "dimensions": {
               "type": "object",
               "properties": {
                    "length": { "type": "number" },
                    "width": { "type": "number" },
                    "height": { "type": "number" }
               },
    },
    "required": [ "productId" ]
}
Tuple validation

JSON Arrays can be validated with tuple validation:

{
    "type": "array",
    "prefixItems": [
      { "type": "number" },
      { "type": "string" },
      {
        "type": "string",
        "enum": ["Street", "Avenue", "Boulevard"]
      },
      {
        "type": "string",
        "enum": ["NW", "NE", "SW", "SE"]
      }
    ],
    "additionalItems": false
  }

where valid data are:
[1600, "Pennsylvania", "Avenue", "NW"]
[10, "Downing", "Street"]

and non-valid are:
[24, "Sussex", "Drive"]
["Palais de l'Élysée"]
[1600, "Pennsylvania", "Avenue", "NW", "Washington"]

Schema can be defined externally:

...
"properties": {
    ...
    "warehouseLocation": {
        "description": "Coordinates of the warehouse ...",
        "$ref": "https://example.com/geographical-location.schema.json"
    }
    ...
}
...

String formats validation

JSON Schema also support string format validation. Following formats are available:

JSON-LD

{
  "@context":{
    "name": "http://schema.org/name",
    "image": {
      "@id": "http://schema.org/image",
      "@type": "@id"
    },
    "homepage": {
      "@id": "http://schema.org/url",
      "@type": "@id"
    }
  },
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/",
"image": "http://manu.sporny.org/images/manu.png"
}
Subject identifier
Type/Class identifier
Base IRI
Compact IRI
{
  "@context":
  {
    "foaf": "http://xmlns.com/foaf/0.1/"
...
  },
  "@type": "foaf:Person"
  "foaf:name": "Dave Longley",
...
}
JSON languages
{
  "@context": {
    ...
    "ex": "http://example.com/vocab/",
    "@language": "ja", // default for the whole document
    "name": { "@id": "ex:name", "@language": null }, // should not have language tag
    "occupation": { "@id": "ex:occupation" }, // not required
    "occupation_en": { "@id": "ex:occupation", "@language": "en" }, // predefined EN
    "occupation_cs": { "@id": "ex:occupation", "@language": "cs" } // predefined CS
  },
  "name": "Yagyū Muneyoshi",
  "occupation": "忍者",
  "occupation_en": "Ninja",
  "occupation_cs": "Nindža",
  ...
}
JSON Lists
{
...
  "@id": "http://example.org/people#joebob",
  "nick": [ "joe", "bob", "JB" ], // does not keep the order
...
}
{
...
  "@id": "http://example.org/people#joebob",
  "nick":
  {
    "@list": [ "joe", "bob", "jaybee" ] // keeps the order
  },
...
}

Relational data formats

SQL dump

Delimiter-Separated Values (DSV)

Tab-Separated Values (TSV)

Comma-Separated Values (CSV)

URL in CSV

CSV on the Web (CSVW)

main entities in the model:
- table group
- table
- row
- column
- cell

example of schema describing columns, rows and cells:

{
    "@context": ["http://www.w3.org/ns/csvw", {"@language": "en"}],
    "@type": "Table",
    "@id": "https://example.org/table1",
    "url": "https://example.org/table1.csv",
    "tableSchema": {
        "columns": [{
          "name": "airport", // URI compatible name
          "titles": "letiště",
          "datatype": "string"
        }, {
          "name": "continent", // URI compatible name
          "titles": "kontinent",
          "datatype": "string"
        }],
        "primaryKey": "airport",
        // reference to the other table below
        "foreignKeys": [{
          "columnReference": "airport",
          "reference": {
            "resource": "https://example.org/table1.csv",
            "columnReference": "airport"
               }
          }]
      }
}

Where to find the CSVW metadata?

Key-Value formats

.properties file

INI file

dbsetting.ini example:

; last modified 1 April 2001 by John Doe
[owner]
name=John Doe
organization=Acme Widgets Inc.

[database]
; use IP address in case network name resolution is not working
server=192.0.2.62     
port=143
file="payroll.dat"

TOML

# This is a TOML document

title = "TOML Example"

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00

[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }

[servers]

[servers.alpha]
ip = "10.0.0.1"
role = "frontend"

[servers.beta]
ip = "10.0.0.2"
role = "backend"

YAML

---
# An employee record
name: Martin D'vloper
job: Developer
skill: Elite
employed: True
foods:
  - Apple
  - Orange
  - Strawberry
  - Mango
drinks: ['Coke', 'Sprite']
languages:
  perl: Elite
  python: Elite
  pascal: Lame
motto: > # ignores the newlines
  make hey,
  while the sun shines
education: | # preserves newlines
  4 GCSEs
  3 A-Levels
  BSc in the Internet of Things
---

key can be a complex type:

---
# key 
? 
  - "Detroit Tigers"
  - "Chicago cubs"
: 
# value
  - 2001-07-23
---
# key
? 
  - "New York Yankees"
  - "Atlanta Braves"
: 
# value
  - 2001-07-02
  - 2001-08-12
  - 2001-08-14
---

supports anchors and aliases:

- 
  center: &ORIGIN {x: 73, y: 129} # definition
  radius: 7
- 
  start: *ORIGIN # alias reuse
  finish: { x: 89, y: 102 }
- 
  start: *ORIGIN
  color: 0xFFEEBB
  text: Pretty vector drawing.

Text document formats

Plain text

Rich text

Enriched text

Rich Text Format (RTF)

602

HTML

Markdown

CommonMark

Wikitext

links:

[[copy edit]]
[[copy edit]]ors

[[Android (operating system)|Android]]
[[Frog#Locomotion|locomotion in frogs]]

https://www.wikipedia.org
[https://www.wikipedia.org]
[https://www.wikipedia.org/ Wikipedia]

result in:

copy edit
copy editors

Android
locomotion in frogs

https://www.wikipedia.org
[1]
Wikipedia

TeX

LaTeX

simple document:

\documentclass{article}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}

\title{First document}
\author{Oscar Magnuson}
\date{January 2024}

\begin{document}

\maketitle

Hello world!
\[
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]
\end{document}

supports many sections:

\part{name} % not in article
\chapter{name} % not in article
\section{name}
\subsection{name}
\subsubsection{name}
\paragraph{name}
\subparagraph{name}
\section*{name} % not numbered

support lists:

% unordered
\begin{itemize}
    \item One
    \item Two
    \item Three
\end{itemize}

% ordered
\begin{enumerate}
    \item One
    \item Two
    \item Three
\end{enumerate}

referencing:

\section{Introduction}
\label{section:Intro}
First document. This is a simple example, with no 
extra parameters or packages included.

\subsection{Subsection}

As we could see in \autoref{section:Intro},

Multimedia formats

Single-media

Graphics

Vector graphics
Rastr graphics
Color models
BMP - Device-independent bitmap
Run length coding
Blockwise coding
QuadTree coding
Raster formats with lossless compression
Raster formats with lossy compression
Video formats
Digital audio formats

Multi-media

Multimedia container format

PostScript

Portal Document Format (PDF)