For Programmers: Free Programming Magazines  


Home > Archive > Prolog > October 2004 > Looking for real world exemple of semweb in swi









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Looking for real world exemple of semweb in swi
djame@jamais-de-la-vie.com

2004-10-12, 8:56 am

Hello,
I'm currently using the jena (java, http://jena.sf.net) api to
manipulate an ontology but I have yet to find how to think in "jena" so
the prolog approch is much more natural for me, that's why I'm playing
with the swi's rdf library but It lacks some exemple, for exemple :
how to add a property to a class ?
how to get all the children of a concept ?

So I was wondering where to get examples, I digged around in swi-prolog
and except the official doc, it seems there are no tutorials.

More over, the doc refers to a 'owl.pl' file which isn't included into
my swi version (5.4.2 win32).


Can someone point me to a kind of prolog rdf heavean ?


Cordially,




Djamé
Jan Wielemaker

2004-10-12, 8:56 am

In article <416b9f40$0$28944$636a15ce@news.free.fr>,
djame@jamais-de-la-vie.com wrote:
> Hello,
> I'm currently using the jena (java, http://jena.sf.net) api to
> manipulate an ontology but I have yet to find how to think in "jena" so
> the prolog approch is much more natural for me, that's why I'm playing
> with the swi's rdf library but It lacks some exemple, for exemple :
> how to add a property to a class ?


(1) Learn about RDF. Then (2) do:

create_property(Class, Property, Domain) :-
rdf_assert(Prop, rdf:type, rdf:'Property'),
rdf_assert(Prop, rdfs:range, Class),
rdf_assert(Prop, rdfs:domain, Domain).

I.e. there is no magic here. You've got to understand the triple model
before playing with the semweb library directly.

> how to get all the children of a concept ?


rdf_has(Child, rdfs:subClassOf, Class)

> So I was wondering where to get examples, I digged around in swi-prolog
> and except the official doc, it seems there are no tutorials.


There are indeed no tutorials. The triple model however is explained
in detail in the W3C documents, and the SemWeb library simply implements
this. The rdfs.pl library does a few things that are more `natural' to
the non RDF expert. It only provides query predicates though.

> More over, the doc refers to a 'owl.pl' file which isn't included into
> my swi version (5.4.2 win32).


The situation is explained in the latest CVS snapshot of the docs.
owl.pl is/was planned. There is an owl.pl in Triple20 (use google to
find it). You need to read the comments above the predicates for the
documentation though. There is also the SeRQL package available from the
Library Twiki web
(http://gollem.swi.psy.uva.nl/twiki/...w/Library/SeRQL),
providing an implementation of the Sesame SeRQL query language with
query optimisation. This uses a different view on high-level querying,
defining it as a graph query on the deductive closure under some set of
entailment rules (RDF, RDFS, OWL, ...). Here too, OWL isn't yet
implemented. Maybe there are people around with an OWL reasoner?

Enjoy --- Jan
djame@jamais-de-la-vie.com

2004-10-12, 3:58 pm

Jan Wielemaker a écrit :
> In article <416b9f40$0$28944$636a15ce@news.free.fr>,
> djame@jamais-de-la-vie.com wrote:
>
>
>
> (1) Learn about RDF. Then (2) do:
>
> create_property(Class, Property, Domain) :-
> rdf_assert(Prop, rdf:type, rdf:'Property'),
> rdf_assert(Prop, rdfs:range, Class),
> rdf_assert(Prop, rdfs:domain, Domain).
>
> I.e. there is no magic here. You've got to understand the triple model
> before playing with the semweb library directly.


so I assume the Prop variable will unify whith the answer of rdf_assert
or is this Property ?
here we have rdf_assert(+,-,-), right ?







>
>
>
>
> rdf_has(Child, rdfs:subClassOf, Class)
>
>
>
>
> There are indeed no tutorials. The triple model however is explained
> in detail in the W3C documents, and the SemWeb library simply implements
> this. The rdfs.pl library does a few things that are more `natural' to
> the non RDF expert. It only provides query predicates though.


there is no inference engine or something similar ?




>
>
>
>
> The situation is explained in the latest CVS snapshot of the docs.

I'll have a look.

> owl.pl is/was planned. There is an owl.pl in Triple20 (use google to
> find it). You need to read the comments above the predicates for the
> documentation though.

I find this package but once it was marked as very unstable, I didn't
look further.



> There is also the SeRQL package available from the
> Library Twiki web
> (http://gollem.swi.psy.uva.nl/twiki/...w/Library/SeRQL),
> providing an implementation of the Sesame SeRQL query language with
> query optimisation. This uses a different view on high-level querying,
> defining it as a graph query on the deductive closure under some set of
> entailment rules (RDF, RDFS, OWL, ...). Here too, OWL isn't yet
> implemented. Maybe there are people around with an OWL reasoner?


I wonder why ontology communauty is not more involved into the prolog
fields, they all deal a lot with java, maybe it's easier to think about
ontology as xml document but it looks like simpler to consider triples.






>
> Enjoy --- Jan



Thanks a lot.



Djamé
Jan Wielemaker

2004-10-12, 3:58 pm

In article <416bd848$0$12192$636a15ce@news.free.fr>,
djame@jamais-de-la-vie.com wrote:
> Jan Wielemaker a écrit :
>
> so I assume the Prop variable will unify whith the answer of rdf_assert
> or is this Property ?
> here we have rdf_assert(+,-,-), right ?


Nope. rdf_assert/[3,4] expects ground arguments, as the documentation
states. You have to invent the resource names or use rdf_bnode/1 to
generate a new unique (anonymous) one. You can use rdf_equal/2 and/or
rdf_global_id/2 to map between local names and full URIs.

>
> there is no inference engine or something similar ?


There is an implementation of SeRQL. Basically this translates a
SeRQL path expression into a conjunction of rdf/3 calls that are
(after optimising the order) executed in a so-called `entailment
module', a Prolog module that defines rdf/3 according to a set of
entailment rules. So, in the rdfs entailment module,

rdf(Instance, rdf:type, Class)

not only is true if this triple appears in the database, but also
if if can be derived from the database. I.e. if, using the RDFS
entailment rules, one can prove that Instance is an instance of
Class.

> I find this package but once it was marked as very unstable, I didn't
> look further.


It is, but it provides some useful routines for reasoning in the
world of OWL. It is by no means a full DL reasoner though. A
collegue has implemented such a beast, but a bit naive and not
suitable for real world.

> I wonder why ontology communauty is not more involved into the prolog
> fields, they all deal a lot with java, maybe it's easier to think about
> ontology as xml document but it looks like simpler to consider triples.


Interesting question. The provided semantic web infrastructure for
(SWI-)Prolog proves to be quite intuitive and makes it pretty easy to
write queries. I see no real reason for SeRQL to be used from inside
Prolog for example. They only strong point of the SeRQL library is
the query optimiser, but you can use that seperately.

A possible reason is that the Semantic Web is preceived as an extension
of the Web and therefore languages traditionally strong in this area are
used for the Semantic Web as well. I guess this can only be changed by
providing libraries and tools for Prolog and have people demonstrated
these are more productive, faster, ... than their Java counterpart.

Cheers --- Jan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com