[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: neon: git for structured data [Was: Functional database]

From: Roel Janssen
Subject: Re: neon: git for structured data [Was: Functional database]
Date: Wed, 21 Feb 2018 17:02:07 +0100
User-agent: mu4e 0.9.18; emacs 25.1.1

Attachment: rdf.scm
Description: Binary data

Dear Amirouche,

I'm not exactly sure if this fits in with your plans, but nevertheless
I'd like to share this code with you.

I recently looked into using triple stores (actually quad stores)
and wrote an interface to Redland librdf for Guile.

I attached the source code of the interface.
With this interface, you can write something like this:

--8<---------------cut here---------------start------------->8---
(use-modules (redland rdf) ; The attached module.
             (system foreign))

(define world (rdf-world-new))
(rdf-world-open world)

(define store (rdf-storage-new

(define model (rdf-model-new world store %null-pointer))

(define local-uri (rdf-uri-new world "http://localhost:5000/Redland/";))
(define s (rdf-node-new-from-uri-local-name world local-uri "Test"))
(define p (rdf-node-new-from-uri-local-name world local-uri "TestPredicate"))
(define o (rdf-node-new-from-uri-local-name world local-uri "TestObject"))

(define statement (rdf-statement-new-from-nodes world s p o))
(rdf-model-add-statement model statement)
(rdf-statement-free statement)

(rdf-model-size model)
(rdf-storage-size store)

;; Example mime-type: application/rdf+xml
(define serializer (rdf-serializer-new world %null-pointer "text/turtle" 
(define serialized (rdf-serializer-serialize-model-to-string serializer 
local-uri model))
(format #t "Serialized: ~s~%" (pointer->string serialized))

(rdf-uri-free local-uri)
(rdf-model-free model)
(rdf-storage-free store)
(rdf-world-free world)
--8<---------------cut here---------------end--------------->8---

Kind regards,
Roel Janssen

Amirouche Boubekki writes:

> I tried chez scheme and I think GNU Guile
> is a better platform for what I am trying
> to achieve, so I am back.
> I also know better what I want to achieve.
> I will create a triple store that comply
> with semantic web standard that is
> a RDF triple store. At [0] and [1] you will
> find a primer on what is RDF in the former
> and the concepts in the latter.
> [0]
> [1]
> It will also be branch-able etc... like git.
> Also, I also plan to implement sparql.
> If you find sparql difficult I recommend
> the tutorial at [2] in the mean time.
> It's not very difficult and looks like SQL.
> Hence I also plan to implement sparql [3].
> [2]
> [3]
> What I want to do is something similar to,
> that is a gitlab-like platform for data and replace
> the use of git in projects like [4].
> [4]
> Enough talking, what is the status? Well I finished
> porting what I had in chez and can now run the following
> scenario:
> - In master branch, I commit two triples
> - In other branch, that is orphan branch, I commit
>    two triples among where one of them overlaps with
>    master.
> - I can query both branch
> - In a merge commit, I fix the conflict between both
>    branch.
> - I can query the resulting branch and get the expected
>    result.
> The code might be easier to read [5]
> [5]
> What is missing, in order of difficulty:
> - microkanren package
> - wiredtiger 3 package
> - Turtle aka. .ttl format parser
> - sparql queries parser
> - I am not sure of the status of guile-squee yet
> - pluggable backends
> If you want to work one of this item, send me an email.
> What I plan to work on next:
>    There is a semantic difference between neon
>    and RDF triple stores. In a triple store you
>    can have as many times as you want the same
>    attribute given a subject. That is (ref subject)
>    doesn't return a proper alist.
> There is two other links that remain to be cited
> -
> -
> Happy hacking,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]