Attempto, Prolog, and OWL

I’m starting to experiment with different schemas for my problem domain, role-playing games, which includes:

  1. game rules and procedures (roll 2 dice for damage)
  2. setting, plot, characters (Every dragon is an animal. Every dragon can fly. Chris is a dragon.)
  3. common sense (e.g. how doors work.)

I’d like to build off of an established ontology like Basic Formal Ontology, DOLCE, FRISCO, General Formal Ontology, or WordNet. I need something with concepts and measurements for space (room, kingdom, km) and time (before, after, turn, second), and both concrete objects (Chris) and abstract concepts (idea, plan). I like WordNet because it already includes a lot of intuitive relationships (hierarchical, synonyms, antonyms, etc).

My current plan is to write in Attempto Controlled English and export via APE (the parser) to OWL for visualization and Prolog for querying and embedding in an application. I believe the parser, APE, permits converting an entire Attempto document to both these formats. While I don’t have any specific questions yet, I would appreciate learning from any of your own experience with these tools. Thank you!

@CapelliC , you appear to have some experience in this area, right? APE: DRS-string to clause ready for assertion?

What a nice project !

I’m not sure which kind of ontology could better serve your purpose, and also I think Wordnet doesn’t qualify as an ontology… but it could provide the basic blocks that you can assemble to get something usable from APE. Dealing with time/space/common sense (all together now!) is not going to be easy, and I’m tempted to suggest to keep a lower profile, maybe just start with some FSM, and introduce nondeterminism where absolutely necessary.

For time reasoning, either pack(julian) or pack(date_time) should be evaluated.

About space, see this post - but I’m pretty sure you can find something better easily…

Or, since you are still in the speculative phase, you could read about Bousi~Prolog, that overall could be a more productive path.


P.S. none of these technologies are available in cs_prolog, I fear…

It come to my mind that this Jason’ post could be what you’re looking for…


Sorry I didn’t noticed earlier that Jason moved from to (his move is interesting on its own tough). Look at this newer post instead of what I suggested above.

@CapelliC , I will read carefully read all the content you linked to. Thank you! You seem well-versed in these topics. Do you work in knowledge management or ontology development professionally?

I had some experience in the past…

Is it possible to write something in Prolog and export the logic to OWL? My understanding is that OWL is a subset of FOL called descriptive logic. So, that means no all Prolog programs could be translated to OWL. I ask because OWL seems to be a way to port logic from an environment with a Prolog interpreter to an environment without a Prolog interpreter.

@CapelliC, I see in this thread you wrote that “Variables are the most general term in Prolog, and works in facts the same they do in rules. I think these are a big payload of APE, providing ready (and easy) to use semantic data, waiting for binding to application data.” Like the original poster, I’m struggling to make APE output useful. @jan , do you have any experience with APE at all?

I’m copy-pasting output from the APE command-line tool into the SWI-Prolog window and it accepts the entries. But, the format (to me) is convoluted. I’m not sure how to query it! Using an example from the Attempto website and specifying first-order-logic output in a terminal window:

PS D:\Documents\Programming\Attempto\APE-master> ./ape.exe -text "John is a rich customer." -cfol
<?xml version="1.0" encoding="UTF-8"?>

  <duration tokenizer="0.015" parser="0.000" refres="0.000"/>

What do these ampersands mean? What are the terms that look like fractions (e.g. -1\5)? Regardless, I copy-paste the result into SWI-Prolog’s window, changing &amp to @.

?- assert(exists(A,exists(B,@;(object(C,A,customer,countable,na,eq,1)-1/5,@;(property(C,A,rich,pos)-1/4,predicate(C,B,be,named('John'),A)-1/2))))).

I can get back bits and pieces using exists(A,B). but nothing coherent. How would I query the database to ask “Is anyone rich?”, “Is anyone a customer?”, or ask what properties John has?

Has been a lot of time I attempted Attempto :slight_smile:

Note that the semicolon is actually part of the HTML entity &, that gets quoted - I think - because it’s required by XML.

But most probably you don’t need to undergo the transliteration DRS → XML. I’ve just done on my Windows box

?- pack_install(ape).
?- edit(library(ape)). % just to straight jump into the actual code provided
?- use_module(library(ape)).
?- get_ape_results([text='John is a rich customer.', solo=drs], ContentType, Content).
ContentType = 'text/plain',
Content = 'drs([A,B],[object(A,customer,countable,na,eq,1)-1/5,property(A,rich,pos)-1/4,predicate(B,be,named(\'John\'),A)-1/2])'.

That is, I brutally copied the first query (, line 41) and replaced the quoted text with your one.

From this point, you have to decide how you are going to use those DRS formulae, and - I think - there are really a lot of different ways to interact with your database, that you have to structure indipendently (usually) of the query language.

OK. Thank you. I’ll read up on how other people have used DRS.