Sexta-feira, 7 de Outubro de 2011
Triplestores

To better grasp the problems I’ll face while studying the problem at hand I wrote a small program that interprets simple assumptions like {’bill’, ‘follows’, ‘steve’} or {’sima’, ‘belongs_to’, ‘!mcmm’ } (where the ! denotes a group) and whenever a user produces an event, tries to notify the interested parties.

I’m attaching the code to this post, but right now, here’s what it does. We start by stating a couple of truths...

$D->assume ('lpedro', 'teaches', '!seminario');
$D->assume ('nsimaria', 'belongs_to', '!seminario');
$D->assume ('flacerda', 'belongs_to', '!seminario');
$D->assume ('rcosta', 'belongs_to', '!seminario');
$D->assume ('drei', 'belongs_to', '!seminario');
$D->assume ('noliveira', 'belongs_to', '!seminario');
$D->assume ('csantos', 'follows', 'lpedro');
$D->assume ('csantos', 'follows', 'nsimaria');

$D->assume ('csantos', 'is_colleague_of', 'lpedro');
$D->assume ('lpedro', 'follows', 'csantos');

...then we trigger some actions, to see who the program decides to notify for each type of action, and for each case:

$D->decide ('lpedro', 'asks', 'há dúvidas?');
$D->decide ('nsimaria', 'questions', 'qual é a matéria?');
$D->decide ('nsimaria', 'says', 'the beat starts here.');
$D->decide ('csantos', 'says', 'em aula...');

The output for each decision is this:

lpedro asks "há dúvidas?"
nsimaria notified with "há dúvidas?"

flacerda notified with "há dúvidas?"
rcosta notified with "há dúvidas?"
drei notified with "há dúvidas?"
noliveira notified with "há dúvidas?"

nsimaria questions "qual é a matéria?"
nsimaria notified with "qual é a matéria?"
flacerda notified with "qual é a matéria?"
rcosta notified with "qual é a matéria?"
drei notified with "qual é a matéria?"
noliveira notified with "qual é a matéria?"

nsimaria says "the beat starts here."
csantos notified with "the beat starts here."

csantos says "em aula..."
lpedro notified with "em aula..."
lpedro notified with "em aula..."

At first glance, it seems that the program is working coherently, but if you look closer, you’ll see that some people are being notified twice, others are being notified of their own messages, and others aren’t notified at all (lpedro should have been notified by what nsimaria questions, as the first is the teacher of the latter’s class).

Anyway, the important thing here isn’t the program, its the concept behind it. According to O’Reilly’s Programming the Semantic Web, to implement this kind of logic, one good way to do it is to implement a triplestore. So that’s what I tried to do.

The theory behind it is fairly simple: you start by storing each statement (a statement is a subject-object-predicate triplet) three times: indexing it by subject, indexing it by object, and indexing it by predicate, leaving you with a graph-like structure that you can then analyze. But when you start doing it, some technical and coherence issues arise. So I think I’ll start trying out some triplestore libs I discovered on the intertubes, either to use them, or to learn from them. As its been already said in class, it wouldn't be wise to get distracted on reinventing the wheel, when what matters is the car.

Check out the code (not commented, sorry, but pretty readable): Decider.zip




1 comentário:
De nsimaria a 15 de Outubro de 2011 às 23:58


Comentar post

.mais sobre mim
.pesquisar neste blog
 
.Maio 2012
Dom
Seg
Ter
Qua
Qui
Sex
Sab

1
2
3
4
5

6
7
8
9
10
11
12

13
14
15
16
17
18
19

20
21
22
23
24
25
26

27
28
29
30
31


.posts recentes

. Topography of Terror

. Elevator Pitch: Proposta ...

. Triplestores

. First Meeting

. Review of Tom Stonier’s I...

. Monografia Aphex Twin

. Processing + JMyron + OSC

. VJing with Processing and...

. Nunchuk Norris

. jMyron e Processing

.arquivos

. Maio 2012

. Novembro 2011

. Outubro 2011

. Setembro 2011

. Maio 2011

. Abril 2011

. Março 2011

. Fevereiro 2011

. Janeiro 2011

. Dezembro 2010

. Outubro 2010

.tags

. todas as tags

.participar

. participe neste blog

blogs SAPO
.subscrever feeds