Example with ACE => OWL => N3 rules translation

ATTEMPTO ACE is a controled Natural Language, that is, a formal language but looking like normal english. It is usable as a modeling and specification language for EulerGUI framework.

See : Working with controlled (formal) english : ATTEMPTO ACE ,

Overall diagrams

Run APE in command line :

% ape.exe -uri http://eulergui.sf.net/contact.owl -ulexfile foaf-lexicon.pl -text 'If P is a person that has-homepage something and has-current-project something then P is an n:interesting-contact .' -solo owlxml > interesting-contact2.owl

Run EulerGUI from command line, reading the OWL file just generated :

eg interesting-contact2.owl htpp://jmvanel.free.fr/jmv.rdf

jmv.rdf is my FOAF profile on the Internet.

The translation of OWL into N3 is :

@prefix ns2: <http://eulergui.sf.net/contact.owl#>.

{ ?VAR <http://xmlns.com/foaf/0.1/currentProject> ?t0.
  ?VAR <http://xmlns.com/foaf/0.1/homepage> ?t2.
  ?VAR a <http://xmlns.com/foaf/0.1/Person>
} => {
  ?VAR a ns2:interesting-contact}.

Now click on the button to launch Drools engine. Since the URI <htpp://jmvanel.free.fr/jmv.rdf#me> ( that's me ) has a foaf:currentProjet and a foaf:homepage , it is inferred that he is an interesting-contact . To confirm this, one can either use the user Knowledge Base display in tools to see the whole KB. Or one can use the N3 shell to ask this query (just paste it with Ctrl-V) :

?X a ns2:interesting-contact .

The answer appears at once :

<http://jmvanel.free.fr/jmv.rdf#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://eulergui.sf.net/contact.owl#interesting-contact> .

Under the hood

There is a local lexicon file for ATTEMPTO APE : foaf-lexicon.pl , that tells how to verbalize the foaf concepts in english :

cat foaf-lexicon.pl 

tv_finsg('has-homepage' ,       iri('http://xmlns.com/foaf/0.1/homepage') ).
tv_infpl('have-homepage' ,      iri('http://xmlns.com/foaf/0.1/homepage') ).
tv_finsg('has-current-project' ,        iri('http://xmlns.com/foaf/0.1/currentProject') ).
tv_infpl('have-current-project' ,       iri('http://xmlns.com/foaf/0.1/currentProject') ).

noun_sg( person,        iri('http://xmlns.com/foaf/0.1/Person'), neutr) .
noun_pl( persons,       iri('http://xmlns.com/foaf/0.1/Person'), neutr) .

How to run the demonstration

  1. install ATTEMPTO APE, see http://attempto.ifi.uzh.ch/site/downloads/
  2. download foaf-lexicon.pl from the link
  3. download EulerGUI , preferably the latest snapshot from http://sourceforge.net/projects/eulergui/files/eulergui/1.11/ ; that is an executable (Java) jar

    EulerGUI Manual is available from help menu

  4. run commands as above