SpruceKit
SpruceID
  • 🌲SpruceKit Introduction
    • Decentralized Identity Overview
    • Glossary
  • ⚡Quickstart
  • SpruceKit Mobile
    • SpruceKit Showcase App
      • Installation
      • Getting Started
      • Issue a Showcase Credential
      • Present a Showcase Credential
    • SpruceKit Mobile SDK
      • Introduction
      • Core Components
        • StorageManager
        • KeyManager
        • CredentialPack
        • Card
        • IsoMdlPresentation
        • mDocReader/IsomDLReader
        • Document Scanner
      • SpruceKit iOS SDK
        • Installation
        • Build a Wallet
          • Accept a W3C VC
          • Present a W3C VC
          • Present mDL in-person/offline
          • Present an mDL over the internet
        • Build a Verifier
          • Verify a W3C VC
          • Verify an mDL in-person/offline
          • Verify an mDL over the internet
      • SpruceKit Android SDK
        • Installation
        • Build a Wallet
          • Accept a W3C VC
          • Present a W3C VC
          • Present an mDL in-person/offline
          • Present an mDL over the internet
        • Build a Verifier
          • Verify a W3C VC
          • Verify an mDL in-person/offline
          • Verify an mDL over the internet
  • Verifiable Digital Credentials
    • ⚙️DIDKit
      • Installation
      • Core Concepts
      • DID Methods
      • Runtime Configuration
      • Specifications and Dependencies
      • Quickstart
      • DIDKit Packages
        • Command Line Interface
        • HTTP Server
        • Rust Crate
        • C Interface
        • Java and Android
        • Python
        • Javascript
      • DIDKit Examples
        • Core Functions (CLI)
        • Core Functions (HTTP)
        • did-web in minutes
        • Batch Generation & Verification
    • 🪪ISO mDL
      • Quickstart
      • Core Concepts
      • User Guide
  • Schema Definition Language
    • 🔗TreeLDR
      • TreeLDR Quickstart
        • First Schema
        • Compilation into JSON Schema
        • Compilation into JSON-LD Context
        • Writing a Layout
        • Simple Rust Integration
      • Types
        • Literal Types
      • Layouts
        • Primitive Layouts
        • Literal Layouts
        • Enumeration
        • Array Layout
        • References
      • Compiling
        • Schema Definition Formats
          • JSON Schema
          • JSON-LD Context
          • Resource Description Framework (RDF)
        • Programming Languages
          • Compiling to Rust
      • RDF Vocabulary
      • 💡TreeLDR Basics
        • Types and Layouts
        • Properties
        • Syntax
  • Witness for Credential Claims
    • 🔭Rebase
      • Core Library
      • Rust Client/Witness SDK
      • WASM Client SDK
      • Simple "Basic Post" Schema
      • DNS Witness Flow Schema
  • References
    • Contributing
    • Code of Conduct
Powered by GitBook
On this page
  • Generating an RDF Dataset
  • Importing an RDF Dataset

Was this helpful?

  1. Schema Definition Language
  2. TreeLDR
  3. Compiling
  4. Schema Definition Formats

Resource Description Framework (RDF)

PreviousJSON-LD ContextNextProgramming Languages

Last updated 1 year ago

Was this helpful?

. It is the foundation of and for this reason, the foundation of TreeLDR. Every TreeLDR set of documents is fundamentally an RDF dataset. TreeLDR builds upon the by using the same vocabulary and semantics, extended with its own vocabulary to define layouts.

Generating an RDF Dataset

Generating a JSON-LD context is done by using the rdf subcommand of the command line utility after the list of inputs. No need to specify what to export: everything will be exported in RDF.

tldrc -i input1 ... -i inputN rdf

For instance, consider the following layout for the schema:BlogPosting type:

base <https://example.com/>;
use <http://www.w3.org/2001/XMLSchema#> as xs;

/// An example.
type Example {
	/// A property.
	property: xs:string
}

Using the following command:

tldrc -i example/basic_post.tldr -i example/schema.org.tldr rdf

We can generate the following RDF dataset in :

_:6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://treeldr.org/Layout> .
_:6 <https://treeldr.org/name> "example_property" .
_:6 <https://treeldr.org/option> <http://www.w3.org/2001/XMLSchema#string> .
<https://example.com/Example> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2000/01/rdf-schema#Class> .
<https://example.com/Example> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://treeldr.org/Layout> .
<https://example.com/Example> <https://treeldr.org/layoutFor> <https://example.com/Example> .
<https://example.com/Example> <https://treeldr.org/name> "Example" .
_:7 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://treeldr.org/Field> .
_:7 <https://treeldr.org/fieldFor> <https://example.com/Example/property> .
_:7 <https://treeldr.org/format> _:6 .
_:7 <https://treeldr.org/name> "property" .
_:7 <http://www.w3.org/2000/01/rdf-schema#label> "A property." .
_:8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
_:8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:7 .
_:8 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
<https://example.com/Example> <https://treeldr.org/fields> _:8 .
<https://example.com/Example> <http://www.w3.org/2000/01/rdf-schema#label> "An example." .
<https://example.com/Example/property> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
<https://example.com/Example/property> <http://www.w3.org/2000/01/rdf-schema#domain> <https://example.com/Example> .
<https://example.com/Example/property> <http://www.w3.org/2000/01/rdf-schema#range> <http://www.w3.org/2001/XMLSchema#string> .
<https://example.com/Example/property> <http://www.w3.org/2000/01/rdf-schema#label> "A property." .
_:2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://treeldr.org/Layout> .
_:2 <https://treeldr.org/name> "resource_id" .
_:2 <https://treeldr.org/option> _:1 .
_:5 <http://www.w3.org/2000/01/rdf-schema#label> "A property." .
_:1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://treeldr.org/Layout> .
_:1 <https://treeldr.org/layoutFor> <http://www.w3.org/2000/01/rdf-schema#Resource> .
_:1 <https://treeldr.org/reference> <https://treeldr.org/IRI> .

Importing an RDF Dataset

N-Quads import is not yet implemented.

The TreeLDR compiler (tldrc) can import an RDF dataset like any other input document using the -i option. For instance, we can import and export back the previously generated RDF dataset above, and we will get back the same document:

tldrc -i examples/basic_post.schema.nq rdf
🔗
RDF is a standard model for data interchange on the Web
Linked Data
W3C Web Ontology Language (OWL)
N-Quads