Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Latest commit

 

History

History
77 lines (49 loc) · 3.84 KB

README.md

File metadata and controls

77 lines (49 loc) · 3.84 KB

Sessel

Project Status: Inactive - The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

Sessel is a CouchApp for CouchDB that generates RDF triples from JSON documents, which then in turn can be exported to various serialization formats, or queried through a SPARQL endpoint.

Installation

Clone this repository and use CouchApp to push Sessel to <your_host>/<your_db>:

git clone https://github.com/agrueneberg/Sessel.git
couchapp push Sessel/ http://<your_host>/<your_db>

Alternatively, replicate an existing deployment of Sessel to <your_host>/<your_db> using curl:

curl\
  -X POST\
  -H "Content-Type:application/json"\
  -d "{\"source\":\"https://couchdb.gutpassfilter.de/sessel\",\
       \"target\":\"http://<your_host>/<your_db>\",\
       \"filter\":\"vacuum/rw\"}"\
  http://localhost:5984/_replicate

Export

The generated triples can be exported to various RDF serialization formats by calling the export interface http://<your_host>/<your_db>/_design/sessel/_rewrite/ with one of the following strings added:

A graphical export interface can be accessed at http://<your_host>/<your_db>/_design/sessel/export.html.

Changing the base URI

The default base URI is http://host/db_name/. If you prefer a different URI, add a base_uri parameter to the export URL and provide a percent-encoded value, e.g. http://<your_host>/<your_db>/_design/sessel/_rewrite/export.ttl?base_uri=http%3A%2F%2Fexample.com%2Frdf%23.

Changing the prefix

The default prefix of the base URI is sessel. If you prefer a different prefix, add a prefix parameter to the export URL and provide a value, e.g. http://<your_host>/<your_db>/_design/sessel/_rewrite/export.ttl?base_uri=http%3A%2F%2Fexample.com%2Frdf%23&prefix=example.

Data type mapping

The data types of JSON are mapped to the data types of XML as specified in XML Schema Part 2: Datatypes Second Edition.

  • stringxsd:string
  • arrayxsd:string
  • objectxsd:string
  • nullxsd:string
  • numberxsd:integer or xsd:double
  • booleanxsd:boolean

To activate data type mapping, add a type_literals parameter to the export URL and provide a string value true.

SPARQL Endpoint

Sessel bundles Antonio Garrote's fantastic rdfstore-js, an RDF store with SPARQL support written entirely in JavaScript. A graphical query interface can be accessed at http://<your_host>/<your_db>/_design/sessel/sparql.html. Unfortunately, modern browsers only let rdfstore-js store 5 MB worth of triples. If your data set is large it is recommended to use a standalone SPARQL processor such as ARQ to import the generated triples by pointing it to the export interface:

SELECT *
FROM <http://<your_host>/<your_db>/_design/sessel/_rewrite/export.ttl>
WHERE {
    ?s ?p ?o .
}

Document Conversion

Each JSON document is broken down to key-value pairs. Each key-value pair represents a triple, key and value being predicate and object, respectively. The value of the special key-value pair with the key _id ensuring the uniqueness of a document serves as the subject of the generated triple.