Re: Graphs within Graphs

> On 21. May 2021, at 16:43, Pierre-Antoine Champin <pierre-antoine.champin@ercim.eu> wrote:
> 
> 
> On 21/05/2021 16:10, Henry Story wrote:
>> Can DataSets contain DataSets?
> 
> A dataset is defined [1] in a non-recursive way, so strictly speaking, no.
> 
> Of course, you can "inject" a dataset in another one, provided that there is no collision in graph names (and if there is, by providing an appropriate renaming).
> 
>>  It seems N3 Graphs can contain N3 Graphs, no?
> 
> Yes, that is an important difference between N3 and RDF datasets.
> 
> In a nutshell, a N3 formula is a (generalized) RDF graph accepting more kinds of terms, namely:
> 
> * IRIs
> * literals
> * blank nodes
> * lists (they are 1st class citizens in N3)
> * N3 formulas
> 
> This definitiion is recursive, unlike that of Dataset.

Very good news for N3 🦸 !
Since Signatures are often tied to financial services,
we may still find we are not that far from the World where Marvel
sues us for using their characters without their explicit permission (ʘロʘ)!

Btw, on this topic, I have just I think got an idea as to
how one could model DataSets in a way that could tie in nicely
with Category Theory (so I added Antoine).

I’ll see if I can explain this using Scala’s notation.
I came to this studying Fixpoint Types [1].

We can defined CoFree as a recursive type as Rob Norris does
(CT folks would say this is a functor with two arguments - between the […] -
one of which is a Functor).

case class Fix[F[_]](f: F[Fix[F]])
case class CoFree[F[_], A](head: A, tail: F[CoFree[F, A]])

And then we can define a Graph Functor that is not recursive

case class GraF[A](g: Rdf#Graph, other: Set[A]=Set())

The fixpoint type of this

type Graphs = Fix[GraF]

is just a non empty set of RDF Graphs.

whereas a CoFree version

type NG = CoFree[GraF,Uri]

Gives rise to a nested set of named graphs. Just what we want.
I wrote up an example here btw

https://github.com/co-operating-systems/Reactive-SoLiD/blob/master/src/test/scala/run/cosy/ldp/TestLDPCmd.scala#L117

I use Uri there to annotate the graphs. But one could also put other types there such as a URI and something to represent an
http header, to give metadata for the graph such as time to live, etc…

Henry


[1] There is a very helpful talk On Free  and CoFree from 2016 [Pure Functional Database Programming with Fixpoint Types](https://www.youtube.com/watch?v=7xSfLPD6tiQ) with [slides](http://tpolecat.github.io/presentations/cofree/slides#20), where Rob Norris shows how one can use `Fix` for recursive data structures and `CoFree` as a way to annotate such recursive data.



> 
>   pa
> 
> [1] https://www.w3.org/TR/rdf11-concepts/#section-dataset
> 
>> 
>> That issue just came up today on the Semantic Web Mailing list
>> related to singing signed graphs.
>> 
>> https://lists.w3.org/Archives/Public/semantic-web/2021May/0140.html
>> 
>> Henry Story
>> 
>> https://co-operating.systems
>> WhatsApp, Signal, Tel: +33 6 38 32 69 84‬
>> Twitter: @bblfish
>> 
> 

Henry Story

https://co-operating.systems
WhatsApp, Signal, Tel: +33 6 38 32 69 84‬
Twitter: @bblfish

Received on Friday, 21 May 2021 15:34:17 UTC