SiDIF vs RDF Triple Notations

From BITPlan cr Wiki
Jump to navigation Jump to search

⚠️ LLM-generated content notice: Parts of this page may have been created or edited with the assistance of a large language model (LLM). The prompts that have been used might be on the page itself, the discussion page or in straight forward cases the prompt was just "Write a mediawiki page on X" with X being the page name. While the content has been reviewed it might still not be accurate or error-free.

SiDIF vs RDF Triple Notations

SiDIF (Simple Data Interchange Format) was designed to show that readable triple notation is possible as an alternative to RDF/Turtle/N-Triples.

This page compares SiDIF with Turtle and N-Triples using two concrete examples from contexts.bitplan.com:

  • BookContext - a simple schema with one instance
  • CityContext - a more complex schema with URL, Number and External identifier types

BookContext Instance

SiDIF

LordOfTheRings isA Book
"Lord of the Rings" is Book_title of it
"0261102389" is Book_ISBN of it
"J.R.R. Tolkien" is Book_author of it
"Fantasy" is Book_genre of it

Turtle

@prefix : <https://contexts.bitplan.com/index.php/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:LordOfTheRings a :Book ;
    :Book_title "Lord of the Rings"^^xsd:string ;
    :Book_ISBN "0261102389"^^xsd:string ;
    :Book_author "J.R.R. Tolkien"^^xsd:string ;
    :Book_genre "Fantasy"^^xsd:string .

N-Triples

<https://contexts.bitplan.com/index.php/LordOfTheRings> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://contexts.bitplan.com/index.php/Book> .
<https://contexts.bitplan.com/index.php/LordOfTheRings> <https://contexts.bitplan.com/index.php/Book_title> "Lord of the Rings"^^<http://www.w3.org/2001/XMLSchema#string> .
<https://contexts.bitplan.com/index.php/LordOfTheRings> <https://contexts.bitplan.com/index.php/Book_ISBN> "0261102389"^^<http://www.w3.org/2001/XMLSchema#string> .
<https://contexts.bitplan.com/index.php/LordOfTheRings> <https://contexts.bitplan.com/index.php/Book_author> "J.R.R. Tolkien"^^<http://www.w3.org/2001/XMLSchema#string> .
<https://contexts.bitplan.com/index.php/LordOfTheRings> <https://contexts.bitplan.com/index.php/Book_genre> "Fantasy"^^<http://www.w3.org/2001/XMLSchema#string> .

CityContext Schema Fragment

The CityContext introduces additional challenges with URL, Number and External identifier types:

SiDIF

City_qid isA Property
"Has Wikidata item ID" is name of it
"External identifier" is type of it
"Global" is scope of it
"https://www.wikidata.org/entity/$1" is formatterURI of it
"" is namespace of it
"City" is topic of it

Turtle

@prefix : <https://contexts.bitplan.com/index.php/> .
@prefix wikibase: <http://wikiba.se/ontology#> .

:City_qid a :Property ;
    :name "Has Wikidata item ID" ;
    :type "External identifier" ;
    :scope "Global" ;
    wikibase:formatterURL <https://www.wikidata.org/entity/$1> .

N-Triples

<https://contexts.bitplan.com/index.php/City_qid> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://contexts.bitplan.com/index.php/Property> .
<https://contexts.bitplan.com/index.php/City_qid> <https://contexts.bitplan.com/index.php/name> "Has Wikidata item ID" .
<https://contexts.bitplan.com/index.php/City_qid> <https://contexts.bitplan.com/index.php/type> "External identifier" .
<https://contexts.bitplan.com/index.php/City_qid> <https://contexts.bitplan.com/index.php/scope> "Global" .
<https://contexts.bitplan.com/index.php/City_qid> <http://wikiba.se/ontology#formatterURL> <https://www.wikidata.org/entity/$1> .

The 4 Problems

1. Blank nodes

In SiDIF every entity has a named identifier (e.g. LordOfTheRings). RDF allows anonymous blank nodes (e.g. _:b0) which have no SiDIF equivalent. A SiDIF→RDF converter must decide whether to generate URIs or blank nodes for unnamed instances.

2. Namespaces/prefixes

SiDIF uses plain identifiers like Book_title and City_Population. These must be mapped to URIs. The SMW convention of using the wiki base URL as namespace works for known wikis, but CityContext has "" is namespace of it for global scope properties — these need a separate mapping to e.g. a Wikidata or schema.org prefix.

3. Literal types

BookContext uses Text → xsd:string and Date → xsd:date. CityContext adds Number → xsd:integer and External identifier → a URI formatted with formatterURI. The full SMW type to XSD type mapping needs to be defined explicitly for a lossless conversion.

4. Round-trip fidelity

Several SiDIF/SMW constructs have no direct RDF equivalent:

  • isArdf:type
  • is ... of it → property triple ✓
  • addsTo → no RDF equivalent
  • formatterURIwikibase:formatterURL (approximation)
  • scope=Global → no RDF equivalent
  • index, showInGrid, mandatory → no RDF equivalent

A round-trip SiDIF→RDF→SiDIF would lose these SMW-specific annotations unless a custom vocabulary is defined.

See also