Fork me on GitHub

Introduction

SMd is an extension on the Markdown syntax that enables to embbed markup needed to couple linear writing and RDF triples.

The RDF triples embedded in a SMd file can be extracted as well as the linear text can be used by a tool like Pandoc to produce a html or pdf file.

In terms of user experience, SMd enables to write linearly and extract the graph that is stored inside the text, capturing the non-linearity inherent to any speech.

Another possible use is the annotation of existing linear text as Markdown is fully compatible with SMd.

Syntax

Basics

In RDF, sentences follow the pattern:

subject predicate object .

In the SMd syntax, subjects and objects are identified with an @ symbol.

Predicates (also named properties) are identified with the § symbol.

In RDF, a triple (subject-predicate-object sentence) is terminated by a . (comma). In SMd, punctuation symbols are the same and are simply doubled:

SMd: A @molecule is @composed of @atoms

RDF: ex:molecule ex:composed ex:atoms .

plain text: A molecule is composed of atoms.

Flexibility comes with complexity

As in RDF, there can be several objects:

subject predicate object1 , object2 , … , objectn .

For example,

SMd: An @atom is §composed of a @nucleus, and @electrons

RDF ex:atom ex:composed ex:nucleus , ex:electrons.

plain text: An atom is composed of a nucleus, and electrons.

Multiple predicate-objects are possible, too:

RDF: subject predicate1 object1 ; predicate2 object2 ; … ; predicaten objectn .

as in:

SMd: An @electron §is a @elementary ;; and is §charged @negatively

RDF: ex:electron ex:is ex:elementary ; ex:charged ex:negatively .

plain text: An electron is a elementary and is charged negatively.

Literals

All previous examples involve subjects and objects that are strings that will be converted into URIs (see URIs and Namespaces below).

Objects may also be literals, that is to say strings that will be stored without modification. The symbol % in association with opening and closing " delimitates literals:

SMd: An @electrons has §mass %“9.1e-31 kg”…

RDF: ex:electrons ex:mass “9.1e-31 kg” .

plain text: An electrons has mass 9.1e-31 kg.

Long labels

Surrounding the one or more words after an @, § or % symbol will make it part of the object, predicate or subject

Expert zone

(I’m kidding, it remains easy, though a bit more RDF specific)

URIs

In the first implementation of the SMd converter, URIs are produced by converting labels to CamelCase. Another possibility is to use blank nodes and an rdfs:label “text” triple. Not achieved.

Namespaces

A generic namespace is used for labels that do not indicate a specific namespace. To use a specific namespace, place it’s abbreviation between the @ or § symbol and the label or opening ".

SMd: A @dbpedia:molecule is @dbo:composed of @dbpedia:atoms

RDF: dbpedia:molecule dbo:composed dbpedia:atoms .

plain text: A molecule is composed of atoms.

Alternative text

The words used to produce the label and the text that is kept in the plain text version can be different, writing first the pseudo-URI and secondly the alternative text, making use of " as in:

SMd: A @dbpedia:Molecule"molecule" @dbo:“has composition"is composed” of @dbpedia:Atoms"atoms"…

RDF: dbpedia:Molecule dbo:hasComposition dbpedia:Atoms .

plain text: A molecule is composed of atoms.

Several combintations of " are possible (not yet stabilised), following the principle of writing of strictly needed symbols.

Named graphs

This syntax extends the markdown syntax and the management of titles in Markdown is used in order to delimitate Named Graphs. Think about the # as the equivalent of @ but for a graph URI, as in:

SMd:

# Physics

A @molecule is @composed of @atoms

RDF:

ex:Physics { ex:molecule ex:composed ex:atoms .}

plain text:

Physics

A molecule is composed of atoms.

Extensions

Several extensions can be produced, starting from this extension of the Markdown syntax. Some have been considered as useful for enabling the user to keep his complex linear sentences and yet produce triple based graphs.

Uses

Text authoring

The SMd syntax can be used as the time of writing, and possibly reveal the appearance of non-linearity in writing.

Text annotation

Another use case is the annotation of existing texts, more focused on the quality of the produced graph.

Licence

The SMd syntax is licenced under CC-BY-SA and credits the authors of Markdown, RDF and SPARQL and all software dependencies are used with respect to the respective licences.

Developer’s note

This extension of the Markdown syntax was guided by both wide theoretical questions (how to couple the writing of linear texts and non-linear graphs) and personal issus (how to implement this using tools and syntaxe I was already familiar with), hence the choice of a specific syntax (Markdown), an implementation of a SMd to turtle and Md converter and specific issues or bugs that remain at the current stage of development. Therefore, this project should still be considered as technically immature and will surely benefit from any participation.


Jibé @jibe_jeybee About me

All contents on this site are under the free licence CC-BY