Translating OWL and Semantic Web Rules into Prolog: Moving Toward Description Logic Programs

To appear in Theory and Practice of Logic Programming (TPLP), 2008. We are researching the interaction between the rule and the ontology layers of the Semantic Web, by comparing two options: 1) using OWL and its rule extension SWRL to develop an in…

Authors: Ken Samuel, Leo Obrst, Suzette Stoutenberg

Translating OWL and Semantic Web Rules into Prolog: Moving Toward   Description Logic Programs
1 Translati ng OW L and Sema ntic W eb Rules int o Prolog: Mo v ing T oward De scriptio n Logic P rograms Ken Sa muel 1 , Le o Obrst 1 , Suzette S toutenbe rg 2 , Karen Fox 2 , Pau l Frank lin 2 , Adria n John so n 2 , Ken La ske y 1 , Debora h Nichols 1 , Ste v e Lo pez 2 , Jaso n Pe terso n 2 {sa muel, l obrs t, s uzette, kfo x, p f rank lin, abjohn so n, klaskey, d lnicho ls, slopez, jaso np}@mitre.org The MITRE Co rpora tion 1 7525 Co lshi re Drive , McLe an, VA 2 2102 -7508 2 1155 A cade m y Par k Lo op, Co l orado Spr i ngs, C O 80910-37 16 Submi tted 12 May 2006; revised 24 Sep 200 7; acc e pted 18 Octo ber 2007 Abstract . We are res earc hing the interac tio n betwe en the rule and the o ntolo gy la y er s of the Sema ntic W eb, by c o mparing two options: 1) usi ng OWL a nd i ts rule extension SWR L to develop an int eg rated onto logy /rul e language, and 2) layering rules on t op of an onto l ogy with Ru leML and OWL . To ward thi s end, we a re dev e loping the SWO RI ER sy stem, whic h enabl es effic ient au t o mated rea sonin g o n onto l ogies and rules, by translat ing a ll o f them into P rolo g and adding a se t o f g eneral rules t hat proper ly capture t he seman t ics of OW L . We have also enab l ed the user to make dy namic c ha ng es on the fly , a t run time. Thi s work addresses sev eral of the co ncerns expres sed in previous wo rk, such as neg at ion , c om plementary classes, disjunc tiv e head s, and car dinality , and it d iscusses altern ative appro a ches fo r dealing with inco nsi stencie s in the know ledg e base. I n additio n, fo r efficienc y , we i mp l eme nted t echni que s called extens ionaliz ation, av oiding rean aly s is, and co de minimiz ation. Keywo rds: S ema ntic W eb, lo gic prog r amming , kno wledge co m pilatio n, o ntolo g ies, rules 1. In troduction The we dding of S em a ntic Web t echnology a nd L o gic Pr og r amming h a s cr eated a new te chnical par adigm called de scription log ic programming . Recen t ly, re se ar che r s h a ve b egun focusing on the q u estion of how to utilize logi ca l rule s fr om a pa rtic ular dom a i n in order to im pr ove t he S em a n tic Web (Bechhofer et al. 2004; Hirtle et al. 2004; Horrocks et al . 2004). It is well established t hat the knowle dge developme nt language and t he knowledge runtime languag e m a y not be the sa me , s o the f o r me r should b e t ra n sformed to t he latte r fo r gre at er ef fi ciency a t run time (Cadoli & Donini 1997; D ar w iche & Mar q uis 2001). We have develo p ed SWORIER (S em a ntic Web O ntologie s a nd Rules for I ntero p e r abi li t y with Efficient R easoni ng), wh ich is a syste m t hat use s Logic P rog ra mming to r e ason a bout and answe r queries about ontolog ies and r ule s (Grosof et al. 2003; Hitz ler et al. 2005; V olz et al. 2003). OWL (We b On tol o gy Language) ontologie s ( Bechho fer et al. 2004), a long with r ule s in the S em a n tic Web R ule Language (SWRL) (Horrocks et al. 2004) or the R ul e Mar kup La n guage (Rule ML) (Hirtle et al. 2004) ar e a ll t ransl a ted into Pr olog using XS LTs (Exten s ible Style s heet Lang ua ge Transfo r m a tions). I n a ddition , we h a ve w ritt e n a se t of General Rules in Prolog in orde r to enforce t he s eman t ic s of OWL primitives. T o do this, i t w as nece ssar y to addr e ss a num b er of i ssu e s r el at ed t o negation, t he open wo r ld a ssum ption, c ompleme ntar y a nd disjoint cl asses, disjunctive con clusions, enume r ated classes, eq ui v alent individuals, e r ror me ss age s, e xist en tial quan tification , car d inality constraints, d uplicate facts, cy clical hie r ar ch i e s , and anonym ous c lasse s. R ecen t work has suggest ed that some of these pr o b lem s a re unsolvable (Volz et al. 2003), but w e b elieve we h a ve found s o lution s f or the m. 2 We h ave imposed str ong efficiency req u irem ents, dem a nding t hat que r ie s a re answe r e d in a matte r of s econds. And, unlike pr evious wo rk, SWORIER can assimil at e dynamic changes that ar e provided at r un time, in cluding a dding new facts, remov ing facts, a n d s wapping r ule s ets, which als o m ust be done in s econd s. T o achieve this level o f e fficiency, we establi s hed t hree te chniques: e xt en si on alization, a vo iding r e analysis, a n d code min imization. This paper is or gani zed as follow s : First, Sec t ion 2 pr ovide s t he r e ader with bac kgro u nd info r m ation. Then, Section 3 descri b e s SWORIER's sy st em de s ign. Sec t ion 4 add resses th e ch allenges f ound in pr evio us r esearch. Sec t ion 5 adds a capabili ty t o handle dyna mi c changes. Sec t ion 6 a n alyz e s and a ddre ss e s the e fficien cy of t he s ystem , and then S ection 7 di scuss e s rel a t ed work. Finally, Sec t ion 8 summ a riz e s the paper, offe rs concl usions, a n d discusses future wo rk. 2. Back gro und We are i n vestigating the inte ra ction between rules and ontologies i n t he Sem a ntic Web to de t e r mine how a sta n dard l anguage should be st e x press them ( Stoutenburg e t al. 2006). In particul a r, to determ ine whe t her an ontology and the c orresponding r ules should be int eg r at ed or laye r ed , we s pecified , tr ansl ated, and exe cuted information in: 1) S WRL, which i n t eg ra te s OWL with rules (Horr o ck s et al. 2004), and 2 ) RuleML layered on top of OWL. T he ontologie s a nd instance s we r e developed in t he Cerebra OWL on t ology developmen t environme nt, 1 t he S WRL and Rule ML rules were cr eated in a te xt edi t o r, and AMZI! (2006) P rolog w a s used as the infe r en ce engine . W e tr anslated t he con structs fo r both the int eg r at e d and laye r ed a pproache s into Pr o log code, g auging e ac h approach in t e r m s o f e ff e cti vene ss, e fficien cy, di fficulty, restrictivene ss, transl ata bil ity, and sui tability fo r de pl oyme nt in an ope ra tion al s e tting. Figu re 1. A Mil itary T ask 1 http://cereb ra.com/inde x.h tml 3 Our initi al e xper ime nts wer e s e t in a mili tar y comm a nd a nd con t rol dom a in wi t h a supply convoy moving t hrough a n unsecured area. Figure 1 pr e s en t s an exam p le situat ion , where a convoy is moving north al ong t he pr im a r y route, appr oach ing t he location whe r e intelligence has repo r t ed a n enemy sni per is sta tioned . New information can becom e available at a ny time , suc h a s the discovery of a the a t e r o bject or the beginning of a sand st or m . The s y st em h as rules that trigge r ale r ts an d r ecomm end a t ions to r e p o rt to the c on voy comm a nde r. For exam p le, in the s ituation shown in Figur e 1, a n enem y u nit is within the c onv oy's region of inte r est (the c ircle surr ound ing the c onvoy ), so the s ystem m i gh t t ell the convoy c omm a nde r, "ALERT: In t ellige nce r e port o f enem y sniper in the vicini t y." and "RECOMMENDA T ION: T ake alt e rnate r oute ." Most know ledge representation language s a nd knowledge -based syst em s utilize a restricte d ve rsi on of First Order Logic (FOL). FOL, howeve r , is s emi- decidable . It is dec idable in that if a t heo r em is logically en tailed by a FOL theo r y, a pr o of will even tual ly b e fo und, but it is unde cidable in t hat if a t heo r em is not logically entailed, a pr oo f of t hat m a y neve r b e f ound. But decid a bility he r e does not mea n t ra ctabil ity , a nd in gene ra l even inferenc e i n t he simple r propo sitional ca lcul us is NP -com p lete (Ca d oli et al. 1999), i.e . , usua ll y u nable t o b e pr oce ss ed in le ss than e xp onenti al time. Figu re 2. System Des ign To m ake inference tr acta ble , vario us appr o ache s i n t he field of know ledge compilation , which involve s c onve rting a knowledge bas e into a more concise or tr actable r e presen tati on, have been devised (Cadoli & Donini 1997; Darw iche & Mar q uis 2001). On e approach is to syntacti cally restric t the know ledge r e presen tat ion l a nguage , sacr if icing e xpressivene ss fo r tractabili t y and efficiency (de Bruijn et al. 2004). Logi c pr ogramm ing (LP), de scription logi c (DL), a nd de scr iption logic pr ogra mm i ng (an eme r ging f ield t hat wed s DL a nd LP ) t ake thi s approach (Ait-Kaci 1991; Grosof et al. 2003; Hi tzle r et al . 200 5; V a n R oy 1990; V olz et al. 2003). F o r e xa m pl e , OWL is a DL that de fines a tra ctable subs e t of F irst-Or d e r Logic (B echhofe r et al. 20 04; Daco nta et al. 2003) . A n a lternative i s to employ t heory a pproxim a tion (Kaut z & 4 Selm a n 1994; Kautz & S e lm a n 1991) , i n which the querie s th a t are logi cally en ta iled by a knowledge base (a “t heo ry”) can b e c orre ctly a n s we r ed , while , for the rest o f t he quer ie s, t he respon s e i s “u nknow n”. Some researche rs preproce ss the knowledge in v ar io us w a ys t o rel ax ei t he r the c om p letene ss o r the s oundne ss r eq u ir eme nts, pe r haps by gene rat ing c e rta in defaul t concl us ions (Cadoli & Don ini 1997). Anothe r p o ssible optimiz ation is to e xt en s ionalize t he rul e base, as di scussed in Se ction 6.1. 3. System Desig n Fig ur e 2 s hows t he s yste m design of S WORIER. A de velope r cr e ates ontologies, knowledge bas e s, and / o r rules in the for m a li s m(s) of OWL, Rule ML, and/ o r SWRL. Ex ample s of OWL, Rule ML, a nd S WRL are in Ta ble 1a , 1b, a nd . 1c, respec ti vely . T hi s i nfo r m ation is transl ated into Pr o log code using XS LTs, resul t ing i n the code s hown in T able 2a, 2b, and 2c. (We include wo rds like "is" a nd " of" in our pr e dic ate na me s to avoid am b igui t y. Otherwi s e , there is the danger of misin t e r pr e t ing t he r ole s of the a rguments. For exam p le, member(X, Y ) co ul d be interpreted a s "X is a mem b er of Y " or "X has a me mbe r, Y", while isme mberof( X, Y) is mo r e clear. ) Final ly, a s e t of General Rules (defined in S e ction 3. 2) is app ended t o t he XSLT output to fo r m a com p le t e Pr olog prog ra m , which can b e que ri ed by the user . Tabl e 1. Exam ples o f OWL , Rul eML, and S WRL a. b. redFo r ceT h eat erOb ject < /op r> X redFo r ceT h eat erOb ject < /op r> X c. < rule ml:v ar>T < rule ml:v ar>G < rule ml:v ar>G < rule ml:v ar>S < rule ml:v ar>T < rule ml:v ar>S 5 3.1. Translating F acts SWORIER use s a syntax diffe r en t fr om t h at t y p ic ally found in previous work . F o r e xa m p le, Volz et al. (2003) would pr od uce the tra nsl ation of T a ble 2 d, in st e a d of t he tra nsl a tion in T able 2a. But we note that the s yntax used by Volz et al. (2003) ca nno t r epre s en t "eve r y class that smith is a me mbe r o f " with X (smith) , because m os t P rolog im p lem entations disallow predi ca t e variables. I n c on tra st, by m aking the class n a me s and pro perty na me s b e ar gumen ts instead of pr edi cate s, S WORIER has the f lexibili ty to gene r alize on t hem with, for e xa m ple, ismemberof(s mith, X) . Tabl e 2. Tran sl ati o n s a. ismemb erof(s mith, sniper) . haspro pertyw ith(sm ith, ha sComba tInten t, fri endlyIn tent). b. ismemb erof(X , redF orceThe aterOb ject) :- isMem berOf( X, red ForceTh eaterO bject) . c. ismemb erof(s mith, sniper) . haspro pertyw ith(T, hasSpe ed, S) :- hasPr operty With(T , isDes cribed By, G) , hasPr operty With(G , hasSp eedObs ervati on, S) . d. sniper (smith ). hasCom batInt ent(sm ith, fr iendly Intent ). 3.2. Gene r al Rule s The Gene ra l R ules ar e m ea n t t o c aptur e the s em a n t ics o f the pri mi t ives in OWL. For e xa m p le, t he rule s in T able 3a enforce t he tr ansitivi ty of subclass. No t e th a t the r e a re t wo dif fer en t predi cat e s : iss ubclassof and isSubClassOf . One predicat e wo uld b e insuffi cient, bec aus e Table 3b has lef t r e cursion, r e sulting in an infini te loo p. Tabl e 3. Th e Tran s itive Clos u re o f S ub class a. isSubC lassOf (C, D) :- iss ubclas sof(C, D). isSubC lassOf (C, E) :- iss ubclas sof(C, D), i sSubCla ssOf(D , E). b. isSubC lassOf (C, E) :- isS ubClas sOf(C, D), i sSubCla ssOf(D , E). Wi t h two differen t subclass pr e dicat e s, some q u estion s m ust be a nswe r ed . Should t he use r sub mi t queries with iss ubcla ssof or isSubC lassOf ? Al so, which for m s hould th e input from t he XSLTs be? If the input us ed is SubClas sOf , t h en neither of t he r ules in T able 3a wo u ld eve r s ucceed , thus the in put m ust use i ssubclassof . O n the othe r h a nd, querie s should us e is SubClassOf be cause the iss ubclassof se t of facts is inc om p lete none of the subclass relation s hips t hat ar e derived b y tra nsi ti v ity ar e ca ptured b y issubclassof . Note that the is subclassof set of facts is a subse t of t he is SubCl assOf set of facts, be caus e of the first r ule in Ta ble 3a , w hich is called the conversion rule for subcl a ss. For consi st en cy, we creat ed two cas e s of each predicat e , a ll -lowe r cas e a nd ca mel cas e . 2 Also, e ac h pr edi cat e has a co nve rsion r ule . T he XSLT f acts alw a y s use t he al l-lowe r case f orm s of predi ca t e s , while t he us er que ries a re a lway s in ca melcas e . (Howeve r , the develo per decides how to spell the na me s of c on stants, such as hasSpee d in T a ble 2c.) And any rules, othe r tha n rec ursi ve rul e s and c onve rsion rule s, follow the convention: 2 A ny predicates t ha t ar e n ot used fo r input or outpu t ar e written in an unde r sco re case, suc h a s is_sub _class _of_bu t_not_e qual_t o . Also , for some pr edicates, th e r e ar e two sources of recursio n, r equiri n g thr ee case s of t he predicate. A n examp le of th is is the membe r r elation, f or w h ic h th e three c ases are ismem berof , is_membe r_of , a n d isMe mberOf . 6 All predicates in the body of the rule are camelcase, and the predicate in its head is all-low ercase . A s a n example , s ee t he s econd r ule in T able 2c. Using ca mel cas e pr edi cates in the rule's body guarantee s t hat the r ule is tr igge r ed b y eve r y thing t hat can b e de r ived f o r that pr edic ate in eithe r case . And usi n g t he a ll-lowe rcas e pr edi cat e f o r t he rule's head insures that any facts gene r at ed b y the r ule will hold f o r both case s of the predicat e . 3.3. Transl ating Rul e s Some of t he in puts pr ovide d t o SWORIER are RuleML or S WRL rule s that we r e cr eated by the develo p e r . It is not difficul t t o tra nsl a te these r ule s into Pr o log, b e ca use t hey ar e w ritten in Ho rn Clause f o r m . H oweve r , we cannot con tr ol w hic h rules a re pr ovide d no r h ow t hey ar e w ritt en . Pr oblem s ca n eme r ge , suc h as the infini t e loop in T able 2b, whi ch was gene r at ed b y t he RuleML r ule in T able 1b. I n a ddi t ion, the o r der in which r ules a re li st ed and the order of t he te r m s in the r ules' bodie s can have significant effe cts , m uc h li ke orde r of join eval uati o n in database language s such a s SQL. Another conce r n is that the input c ould incl u de r ules t hat prod uce duplicate c opie s of a fa ct. (Se e S e ction 4.9.) And the rules migh t b e inefficien t. The r e a re ways t o c orrec t o r a t le ast mitig at e s ome of these pr oblem s. F or exa m p le, w e co ul d appl y tr ansfo r m a tions as for logic querie s in t he form of rewrite rules such a s “ magic s e ts ” optim ization (Ca doli et al. 1999; Sippu & Soi s alon-Soininen 1996) . B ut c urr e ntly, we m us t im p ose st rong r e quiremen ts on t he deve lope r, who m a y need t o b e very f a mili a r with Pr olog prog ra mm i ng t echniq ues, the logical cons eq u ence s o f t he facts in t he ont o logies, and the Gene ra l Rules. 4. Chal l en ges We ar e following t he gro undbreaking work of Volz et al. (2003), who we r e a mon g t h e fi rst rese ar che rs to i nve stigat e OWL-t o -Prolog tr ansl ation. T hey discussed a n u m b e r of pr oblems that the y encounte red in t he c ours e of their work . N ow we a re pr o p o sing s ol ut ions for seve r al of the s e problem s, some of which ar e curr e n tly implemented in SWORIER. 4.1. Neg ati o n Neg a tion in Prolog is not the sa me as neg ation in OWL, Rule ML, and SWRL. Prolog has finite-failure negation , whi c h me a n s t hat not(T) is t rue if it is no t p ossible to prove t hat T is true. Alte rnatively, with the logi cal negation of OWL, RuleML, and SWRL, no t(T) is true if it can b e proven t hat T is false . (I n both cas e s, no t(T) is false if T ca n be proven tr ue .) I n order to close t his gap, we h ave cr e ated a Pr olog pr edi cat e called lo gicNot , and w e a re develo ping r ules t o capture t he s em a ntics of logical neg ati on . T he l ogicNot pr e dicate ta kes one a rgumen t , which must be a term : logicNot( ) . Three exa m ples ar e pr e s ented in T able 4. Tabl e 4. logi cNot logicN ot(isM emberO f(jones , snip er)). logicN ot(iss ubclas sof(the aterOb ject, convoy )). logicN ot(log icNot( isclass (theat erObje ct))). 7 4.2. The Ope n World A ss umption In Prol og, the closed world assumption holds, which me a ns t hat a nything t h at ca nno t b e proven true m ust b e fals e . Al t e r native ly, OWL has an open w orld ass umption , me a ning that a te r m is fa lse only if it can b e pr oven fals e . S o, in Pr olog, a term can only b e true or false, whil e OWL also allow s for the p ossi b ility t hat its truth value ca nnot be determined from t he available info r m ation. Thi s distinc ti on is addr e ss e d wi t h the l ogicNot predi cat e, which w as presen t ed in Sec t ion 4.1. If the us er wants to a sk a true / false question, Q, then it is necessary t o s ubmi t tw o que ries t o S WORIER: Q and lo gicNot(Q) . Table 5 s how s how the s y st em' s r e spons e s to t he s e que ries should be inte rpr e t ed . Tabl e 5. A Tru e/Fal se Q u ery ?- Q. ?- logic Not(Q) . Is Q true ? yes no yes no yes no no no unknow n yes yes err or 4.3. Comple men tar y and Disjoint Classes Volz e t al. (2003) claime d t hat "OWL f e atur e s t he c o mplemen tOf pr im itive , whi c h canno t b e i mpleme nt ed in H orn L ogic s due t o the fact, that th e re m ay b e no negation in th e he a d..." With t he introd u ction o f t he log icNot pre dicate, this is no longe r a probl em. We ca n handle the c ompleme ntar y cl asses as well a s the disjoint classe s with the rules in Table 6. Tabl e 6. Com plem entary and Disj o int Cla sses disjoi ntClas ses(C, D) :- comple mentar yClass es(C, D ). logicN ot(isM emberO f(I, C) ) :- disjo intCla sses(C , D), i s_memb er_of( I, D). isMemb erOf(I , C) : - compl ementa ryClas ses(C, D), lo gicNot (is_me mber_of (I, D) ). 4.4. Multiple Terms in the Head One no t able lim itat ion of H orn rules is t h at t he he ad ( concl us ion) of a r ule cannot have mo r e than one t e r m . T hi s m ea n s, i f t he c oncl usion of a r ule i s t he c onjunc tion of t er m s, i t i s nece ssar y to cr eate m u ltiple rules. For e xa m p le, the logic al sta teme nt i n T able 7a r eq u ires t wo rule s in Pr o log, as shown in Ta ble 7b. But for the logical rul e i n Ta ble 7c, "... no Hor n cl aus e can be sta ted, since di s ju n ction in the head wo uld occ ur. .." (Volz e t al, 2003). We propo s e t o add r e ss this pr oble m b y cr eating a new Pr o log pr edic at e that can be put in the head. S o Ta ble 7c can then b e tr ansl ated into Table 7 d b y using this new or pr e dic at e, whi ch takes two argum ents, each o f whi ch must be a ter m . Of co urs e , we must supplemen t G ene ra l Rul es in orde r to prope r ly establish t he corr ect sem a ntics of disj unction. Some e xa m pl es of t h ose rul e s ar e shown in Ta ble 7 e. No t e that the last rule requir e s the lo gicNot pre dicat e . Un fortunately, t he hea d of t he last r ule in Ta ble 7 e is a variable , which is not a llowe d in Pr o log . Howeve r , a lth ough it m ay not b e p ossible t o solve this problem in gene r al, because w e ar e lim iting o ur a naly s is to OWL, the r e ar e a fi ni t e number of pr edi cates wi t h wh ich that variable can be instantiated , and t his s e t of pr edicate s doe s not req u ire a ny knowledge of the par ticul a r ontologie s or rule s that are pr ovide d b y the develope r . So we can cr eate one r ule for e ac h predi ca t e , a nd some e xa m pl e s ar e pr e sen t ed in Ta ble 7f . 8 Tabl e 7. Con j uncti on and Disjun ct ion in t h e H ead a. IF I is in C, THEN I is an indiv idual , AND C is a class. b. isindi vidual (I) :- isMemb erOf(I , C). isclas s(C) : - isMe mberOf( I, C). c. IF C and D are co mpleme n tary classe s, AND I i s an indiv idual, TH EN I is in C, OR I is in D . d. or(ism embero f(I, C ), isme mberof (I, D) ):- compl ementa ryClas ses(C, D), is Indivi dual(I ). e. or(P, Q) :- P. or(P, Q) :- or(Q, P). or(or( P, Q), R) :- or(P, or(Q, R)). Q :- o r(P, Q ), log icNot(P ). f . isMemb erOf(I , C) : - or(P, isMem berOf( I, C)) , logic Not(P) . isSubC lassOf (I, C) :- or( P, isS ubClas sOf(I, C)), l ogicNo t(P). logicN ot(Q) :- or( P, logi cNot(T )), lo gicNot (Q). or(Q, R) :- or(P, or(Q, R )), lo gicNot (P). 4.5.En u me ra ted Classe s "The owl :oneO f prim itive can be partially supported." ( Volz e t al, 2003) Thi s primi t ive, which corresponds to our P rol og pr e dic at e, isset , defines a class, C, exte nsionally b y provid ing a set o f all and only the individuals in the class, a 0 , ..., a n . For e xa mple , Ta ble 8a decl a res that there ar e e xactly three me mbers of the class c ombat Intent : friendlyInte nt , hostileInt ent , and u nkno w nIntent . Tabl e 8. Enum er ated Cla ss a. isset( combat Intent , [frie ndlyIn tent, hostil eIntent , unkn ownInt ent]). b. isMemb erOf(a i , C). for a ll i c. or(=(I , frie ndlyIn tent), or( =(I, h ostile Intent) , =(I, unkno wnInte nt))) : - isMe mberOf (I, com batInt ent). Volz et al. (2003) observed t hat Ho r n L ogic r ules could b e develo p ed th at would draw the conclusions in T a ble 8b. But the y als o sa y that, "to support the othe r d ir e ct ion ... whi ch s tates that eve r y i n sta n ce o f C is one of t he list ed a i . .. r e quir e s a disjunction in t he consequent of th e rule , whi ch ca n not b e provided b y .. . Ho rn Clauses." (Vol z et al. 2003) Howeve r, wi th t he o r predi ca t e , i n troduced in S ection 4.4, this should no longer be a pr oble m . T able 8c pr e s en ts th e rule that capt u res the s em a n tics of the e xa m p le in Ta ble 8a. 4.6.Err or Messag e s It is desirable for S WORIER t o t est the data fo r consi st en cy. For this purpose, we foll ow Volz et al. (2003) by impleme nting rul e s t o ca tch inconsi st encie s, suc h as tho s e in T able 9. (In orde r to c he ck f or errors, the develo per m ust submi t the query: er ror(X).) In e ac h of the s e e xa m p les, the inconsi st ency i s a dd ressed by sending a n e r ror me ssa ge t o t he develope r. H oweve r, the r e ar e ot he r w ays to handle most inconsistencies. Examples w ill b e pr esen t ed i n S e cti on s 4.7 and 4.8. Tabl e 9. Error Me ssage s error( ['A te rm can not be both t rue an d fals e.', P] ) :- l ogicNo t(P), P . error( ['The empty class c annot contai n anyt hing.', I]) : - isM emberOf (I, no thing) . 4.7. Existen tial Quan t ific ation 9 Pr o log impli citly assume s t hat a ll variable s in any r ule ar e u nive rsa lly q uantifi ed . Howeve r, OWL c an sp ecify existenti a lly quantified va riable s . F or e xa m ple , t he OWL code i n Table 10a s tates that eve ry t heater obje ct is de scr ibed by a t least one observation a rt if act. T here ar e three w a ys to enfo rc e this r e str ic t ion . The simplest is to r epo rt a n error me ssa ge if i t is viol a t ed , a s in Section 4. 6. Volz et al . (2003) us es t he techniq u e of s kolem i zation. And t he t hird approach is to add new facts to the knowledge ba se , whi ch is disc uss ed in S e ction 4.8. Skolem i zation s olve s t he probl em o f a vi olated exist enti al restriction b y le tting a sp ecifi c te r m r epre s ent t he missing individual. This t erm m ust be una m b iguous, so its a rgumen t variables ar e se lected t o m a ke it distin ct. Fo r e xa m p le, give n the r e s triction in Table 10a , if ther e is a the ater obj e ct, I, t h at is no t de scribed b y a ny obse rvation artifacts, then the t er m unnamedIndiv idual(I, describ edBy, observationArtifa ct) i s used to repre sent the r equi r ed obs e r vation ar tifact. In gene ra l, the two r ule s i n Ta ble 10b a re applied in orde r to insure th at thi s t e r m sa tisfie s the e xistential restr ic tion . Tabl e 10. An Exi ste ntial Constraint a. b. haspro pertyw ith(I, P, unn amedIn dividu al(I, P, C2)) :- hasso mevalu esofpr opertyf rom(C1 , P, C 2), is MemberO f(I, C 1). ismemb erof(u nnamed Individ ual(I, P, C2 ), C2) :- hasso mevalu esofpr opertyf rom(C1 , P, C 2), is MemberO f(I, C 1). 4.8. Car d in a lity In OWL, the r e are th r ee cardinality pri mi ti ve s: ( 1) minCardi nality , ( 2) max- Cardinality , and ( 3) cardinality . Each of t hese primitive s ta ke s t hree ar gume nts: a cl ass, a prope r ty, a nd a num b er. The pr imi t i ve s ' me a nings a re t hat e a ch individual in the given cl ass partici pates i n the gi ven property wit h (1) at least, ( 2) a t m ost, o r (3) e xa ctly the given num b er of unique individ ua ls. Tabl e 11. Ca rdinalit y R ul es a. < owl: onPr operty rdf : res ourc e="# desc ribe dBy " /> < owl: card inalit y rd f :da taty pe=" &xsd ;non Neg ativ eInt eger "> 1 < /owl :car dinali t y> b. equi vale ntin dividu a ls( I 1, I2) :- i sMem berO f(I , th eate robj ect) , h asPr oper tyW ith( I, d escr ibed by, I1), h asPr oper tyW ith( I, d escr ibed by, I2). c. enfo rceC onst raints :- i sMe mber Of(I 1, t heat ero bjec t), n ot( hasP rope rtyW ith( I1, des crib edby , I2 )), g ens ym(n ewIn divi dual , I 3), a sse rt(h asPr oper tyWi th( I1, desc ribe dby, I3) ). 10 Volz et al. (2003) c laim s t hat, "the u nr e s tricted us e of cardinality con str ain ts cannot b e supported e fficien t ly in L ogic P rog ra mming envi ronments... " It is true that, in theor y , the r e a re an unlim ited num ber of cardin alit y c onstraints that the develo p er coul d imp ose . Howeve r, we can e xt end SWORIER's syst em design (from F igure 2) by introduci ng a new modul e , a s shown i n Fig ur e 3. Any cardinality constra in ts found in t he ontologie s a re s en t t o this Cardinal ity Rules mod u le, w hich produces one or two Pr olog rules fo r each constra in t. Since ther e ar e a fi ni t e num b er of car din a lity constra in t s in any ontologie s, it i s po ss ible to de velop all a nd only th e nece ssar y cardi nality rule s, a n d th us, the pr o blem i s tr actable . An e xa mple cardin ality c onstraint is e xpr e ss ed by the OWL code i n Ta ble 11a , whi ch says th a t eve r y theate r object is de scrib ed by e xa ctly one individ ua l. Fo r this con stra in t , i t is nece ssar y to gene ra te t wo r ules, one t e sting t o make sur e that there is no more t han on e individ ual, and t he othe r checking that t he r e is at l e a st one i n dividual t h at satisfie s the r estriction . We have t wo option s for the first rule: 1) If two diffe r en t individual s a re found that both desc rib e the sa me theat e r object, we c o u ld r e port an e rr or to the develop e r , as in S ec t ion 4.6, or 2) w e co ul d enforce t he constra in t wi t h t he rule in which sa ys that if any t he at e r obj e ct is described by two individual s, the n those t wo individuals m ust b e e quivalen t. F or the s e cond rul e , t here ar e three options: 1 ) If a t he a t e r object e xists t h at is no t described by a ny indivi d uals, we c ould r eport an error to the develo per, a s in S ection 4.6, 2) the c on s train t coul d b e en forced b y skol em ization , which was e xp lained i n S e cti o n 4.7, or 3) the pr oblem could b e fi x ed b y a dding new facts to t he knowledge bas e . The last o pt ion i s demonstra te d in T able 11c, whe r e t he P rolog pr edic ate, gensym , sets I3 t o a new u n ique c onstant, a nd the a ssert predi ca t e a dds t he r equi r ed fa ct t o the knowledge ba se. (T he que ry, enforceConstr aints , w ould b e run o f fline in orde r to cre ate all of the r equi r ed facts. ) Figu re 3. Th e Cardinal ity R u les Modul e 11 4.9.Duplic ate Facts It is desi ra ble t o pr even t S WORIER from generating the sa me fa ct mo r e t h a n once . T o dem onstr ate the r ation a l e , c on sider t he pr ogram in t he Table 12a. The q u e r y, fac t(X, c, 1) wo u ld cause the system to return two co p ie s of fact(a, c, 1) ; o ne b e ca use of rule 1, and th e othe r through the interaction b e t ween rules 2 and 3. Al though i t is no t difficult to r em ov e repe titive facts in a po st -processing procedure , a signific ant co st in efficien cy can st ill r esul t. Con s ider, fo r example , t he que r y fact 3(a, c, 3) . To det e r mi ne t he a nswer, the s y st em tests the f irst ter m in t he b ody of li ne 3, fac t(a, c, 1) , and it succeeds t wice . T hen t he s yste m runs two t ests on the s econd t erm, f act (a, c, 1) , each t i me f inding two r e sults. T hus, t h e thi r d te r m , s low(c) , must be tested four time s, unnece ssar il y q uadrupling t he time sp en t proce ssing t hat term. And f or t he query fac t3(a, c, 5) , the slo w(c) te s t is r un 16 t imes. So it s hould b e c lear that, w hen d up lic ate fa cts are gene r ated, they can p otenti all y s low down th e prog ra m signific antl y . To block duplicate facts, we can add the t e r m , not(Y=c) to rule 2, a s shown in T able 12b. T hi s pr even ts fa ct(a, c, 1) f rom b eing ge ne ra ted via rule 2. But gi ven t he q u e r y fact(a, Y, 2 ) , the system fails to r e t urn fa ct(a, b, 2 ) , whi ch should be proven b y rule s 2 and 3. This is because , in orde r to t e s t not(Y=c ) , Prolog tr ie s t o prove Y= c . But this is e asy, s ince Y is a n un b o u n d var iable , so it can be s et to c . T h is causes Y=c to succee d , and s o not(Y=c) fail s, a nd the r ule is incorre ctl y blocked. By c hang ing rule 2 as shown in T able 12c, we c a n in sur e th a t Y is bo u nd before not(Y=c) is teste d. Now t he pr og ra m works correctly, and t he dupli cat e s ar e blocked . But unfo rtunately, the s y st em must inve st ig a t e the fact(X, Y, N-1) te rm , even i f t he bl ock, not(Y=c) , i s doomed t o fai l. In a dd ition, rul e 2 is no longe r t ail recursive , s o t he Prolo g com p ile r cannot utilize a s igni f ican t e fficiency improveme nt. Tabl e 12. Du p licate Fa cts a. 1. fact (a, c, N ) :- N>= 0. 2. fact (X, Y, N ) :- N>0 , fa ct(X , Y, N-1). 3. fact 3(X, Y, N) : - fa ct(a , Y, N-2 ), fac t (X, c, N-2 ) , s low( Y). b. 1. fact (a, c, N ) :- N>= 0. 2. fact (X, Y, N ) :- not (Y=c ), f act( X, Y, N -1) . 3. fact (X, b, 1 ). c. 1. fact (a, c, N ) :- N>= 0. 2. fact (X, Y, N ) :- N>0 , fa ct(X , Y, N-1), not (Y=c). d. 1. fact (a, c, N ) :- N>= 0. 2. fact (X, Y, N ) :- isL ette r(Y) , no t(Y=c) , N> 0, fact ( X, Y, N -1). We believe we ca n m a ke t hese r ule s b oth correct and e fficien t. T he key is that we r equi r e all c on sta n ts t o b e de clar ed wi t h predicat e s like i sclass , isindividual , i s property , and is datatype . The n , by specifying the r equi r ed type of Y a t th e b eginning of the rule 's body, as in rule 2 in Ta ble 12 d, t his has the desi r ed e ff e ct of binding Y , enabling t he b locke r not(Y=c) to be te st ed . 4.10.Cyclic Hierar ch i e s Cyclic cl ass hie ra rchie s and cyclic property hie r ar ch ies can be problem a t ic . Suppose t he given OWL ontology incl udes the facts shown in Ta ble 13a. T hen the computation of the transi tive c losure of subclass, using t he rul e s f rom T able 13b, pr od u c e s an infini t e number o f respon s es t o t he q u e ry, is SubClassOf(X , Y) , as the s ystem loops ar ound and a round th e cycle . Even though we m a y claim that a c y clic hie r arch y is e rr oneo us, we c annot prevent t h e develo p er from creating one . S o S WORIER sho u ld be able to h andle it. 12 We pr opo s e changing the subclass transi tive cl o sure rule s ( Ta ble 3a) in to t he r ule s in Table 13b. T he i de a is t o st op t he c ycle when it r e ac hes the beginning again, which occurs when the t wo pa ra me t e rs of isS ubClassOf are eq ual. For thi s purpose, we cr eate a new pr edicate is_sub_class_of_b ut_not_equal _to that incl u des all of t he subc lass rel ations, exce pt fo r the r efle x ive ones. (The first r ule catches t hem .) N o t e that we us e the t echniq u e discuss ed i n Sec t ion 4.9, by including isclass pre dic at es to i nsure that the variable s a re bound b efore running a ny n ot tests on them. Tabl e 13. Cycl ic Hierarchies a. issubc lassof (armed Force, coalit ion). issubc lassof (coali tion, p olitic alGrou p). issubc lassof (polit icalGro up, ar medFor ce). b. isSubC lassOf (C, C) . isSubC lassOf (C, D) :- is_ sub_cl ass_of _but_n ot_equa l_to(C , D). is_sub _class _of_bu t_not_e qual_t o(C, D ) :- i ssubcla ssof(C , D). is_sub _class _of_bu t_not_e qual_t o(C, E ) :- iscla ss(C), iscla ss(E), not(C= E), issub classo f(C, D ), is_s ub_cla ss_of_ but_no t_equal _to(D, E). 4.11. Anonym ous Classes OWL can define classes call ed a nonymo us c lasse s without actua ll y na min g t hem . T a ble 14a has a n example of an anonymous class, a nd Table 14b has our sugge st ion of how t o tra nsl ate it. An anonym ous class, unnamedCl ass(hasComb a tIntent, frien dly-Intent) , is gene r ated like anonymo us individ uals that were presented in S ec tion 4.7. Tabl e 14. An o nym ous Classes and Prop erties a. b. hasa llva lues ofprop e rty f rom ( un name dCla ss(has C omb a tIn tent , fr iend lyIn ten t), ha sCom batI ntent, fr iend lyIn tent). 5. Dynam ic C han g es Ano t he r use ful ca pability is to c h ange the knowledge base a t r un time . F o r e xa m ple , in our convoy ta sk, in t elligence r eports can come in at any ti me d ur ing a scenario, and we w a n t SWORIER to be able t o incorporate the new i n for m a tion in t o t he knowledge ba s e . T h is m ust b e done within a few second s. So, we have en ab led S WORIER to accom mod a t e dynamic changes of facts, adding o r removing facts at run time . (We h ave not yet tri ed dyna m i cally c hanging c lasse s, prope r ties, o r r ule s. ) Unfortunately, dyna mi c ass e rt ion s significantly decre a s e efficien c y, because the P rolog compile r can no longe r b e used. It is no t possible to a ssert or retract any facts w ith predi ca t e s that ar e compiled . T h is issue i s a d dressed in Section 6.3. SWORIER is also capa ble of dynamic ally c hanging rules, but only in a r e str ic t ed way. We r eq uire t hat a ll o f t he de s ir ed r ule s e ts ar e a v ailable in advance. T h is can still b e q uite us e ful. For e xa m pl e , under l ow vi s ibility conditions, differen t rule s might be desir ed from t he rules us e d with high vi sibility. Both rule sets can be develo p ed in a dvan ce, a nd the n SWORIER can gene r ate a separa te prog ra m f or each case. T he s e r ules migh t be c on s ide r ed dif fer en t p olicie s or rule s invoked b y di ff e rent contexts. A t run time , when vi sibility i s high , the us er que ries a r e submi tt ed to t he first prog ra m . But whe never vi s ibility is lost, such as a t the ons e t of a sa n dstor m , the two programs ar e swapped , a n d the us e r queries are sen t to the second pr og r am . 13 Fig ur e 4 shows t he s y st em aft er it is extende d to a ccomm odate dynamic changes. Not e that whe never facts are added or r em oved from t he knowledge ba se , bot h pr og ra m s m ust be modi f ied appropriately . Figu re 4. Dyn a mic Chan ges o f Facts and R ul es 6. Eff iciency Ini tially, the SWORIER system w as too slow. A s s hown in Ta ble 15a , it t o ok 1.9 ho urs to inco rporat e two dyn a mi c change s i n to the knowledge base: A report of the c onvoy' s curren t posi t ion a nd sp eed and inform ati on a bout a m otorized infa n try unit a pp roaching i t from a he a d. A fter t hose changes we r e m a de, 1.5 hours we r e needed to r espond t o t he f ollowing que ries: What ar e the po s ition s and sp eed s o f al l known units, and what ar e the curren t alerts a nd recomm endat ions? Tabl e 15. Resp on se Time (online ) Exten s ionalizati o n Code Minimization Dynam ic C han ges Qu er ie s a. no no 1.9 hours 1.5 hours b. ye s no 25.2 min ut es 58 min ut e s c. ye s ye s 10 mi lliseconds 130 mi lliseconds The time efficiency t hat is r equired depends on t he appli cation. F o r our m ilitar y ta sk, once a mi ssion b egins, the s ystem's r e sp on s e s must be ve r y fast. I f i t take s mo r e th a n a few second s to a nswe r a q u ery at run time , t he syst em i s e ffectively us ele ss. Howeve r, b efo r e t he mi s si on begin s, m ore ti me i s gene r ally a vailable fo r knowledge compilation. Stil l, thi s of fli ne proce ssing wo u ld usually need t o be done in hours, no t days. 14 6.1. Exten s ionalization In orde r t o m a ke the system tr actable at r un time , we implemen t ed an o ffline t e c hnique to speed up t he pr ogram . We modified S WORIER to extension a lize all of t he facts th a t can be de rived fr om t he input (th a t a user m ight want t o q u e r y on), c onve rting t he progra m f r om an intension a l for m to an e xt ensional fo r m . F ig ur e 5 shows the modified system de s ign. Figu re 5. Exten sio nalizat ion Table 16a show s s ome sa m p le intensional code , a nd the c orresponding exten sional code ca n b e fo und in Ta ble 16b. T he e xt ensionalization algorithm r uns gene r alized que ries ( i sClass(C) and eq uivalentClasses (C, D) in orde r to der ive al l of the de s ir ed facts and sa ve t hem in the extensional pr ogram . (Note t hat it is e as y to keep duplicate facts out of the exten s ion a l code, because t hey a lways l ook iden tical.) Then, at r un time , the e xt en si on al program us e s t he deri ved facts. Since it only c on sists of facts in ca melcase f orm , s eve ra l of t he rules do no t apply t o t he e xt en s ional code. Only the fa cts that are adde d dynamically t o the knowledge bas e h a ve all- lowe rcase predic at es. 15 Tabl e 16. In ten sio nal and Exten sio nal Code a. iscl ass( regi onOfIn t ere s t). iscl ass( roi) . equi vale ntcl asses( r egi o nOf Inte rest , ro i). isCl ass( C) : - iscl a ss( C ). equi vale ntCl asses( C , D ) :- equ ival entc lass es( C, D ). equi vale ntcl asses( C , C ) :- isC lass (C). equi vale ntCl asses( D , C ) :- equ ival entc lass es( C, D ). b. isClass (regi onOfIn t ere st). isClass (roi) . equi vale ntCl asses( r egi o nOf Inte rest , ro i). equival e ntC lass es( r egi onOf Inte rest , re gion OfI nter est) . equival e ntC lass es( r oi, roi ). equi vale ntCl asses( r oi, reg ionO fInt eres t). This pr e proce ss ing t echnique en a bled t he s ystem t o work much faster, a s show n in T able 15b. Howe ve r , it still r eq u ir ed 25. 2 min ut es t o inc orpo ra te t he sa me t wo dyn a mi c changes as in the previous t e st , and to a nswe r the t wo querie s t ook 58 min ut e s . T hi s is still unacce ptably slow. In a ddi t ion, the o ffline e xt en si onaliz ation pr oce ss caus ed the A MZI Pr olog a pplic ation to cras h , as shown in Ta ble 17a . We pre su me that the computer ran out o f me mo r y. Tabl e 17. Exten sionalization T ime (o fflin e ) Avoidin g Reanal ys is Code Minimization Exten s ionalizati o n a. no no CRASH b. ye s no 13 ho urs c. ye s ye s 6.5 hours 6.2. Avoiding Rean alys is In t he pr ocess of exten sionalizing the code, it was very common t o t e s t a ter m s eve r al time s wi t h t he sa me argumen t s. Thi s unnecessary pro cessing c a n b e ve r y slow . For e xa m pl e , given t he code i n Ta ble 18, t he system must te st is SubClassOf(convoy , theaterobjec t) a t least twice: O nc e when s e ar chin g for al l o f t he tr ue isS ubCla ssOf te r m s, and again when tr y ing to prove is MemberOf( convoy1, t heaterobject) . Tabl e 18. Reevalu a ting a Term ismemb erof(c onvoy1 , convo y). issubc lassof (convo y, mili taryun it). issubc lassof (milit aryunit , thea terobj ect). isSubC lassOf (C, D) :- iss ubclas sof(C, D). isSubC lassOf (C, E) :- iss ubclas sof(C, D), i sSubCla ssOf(D , E). isMemb erOf(I , C) : - ismem berof( I, C). isMemb erOf(I , D) : - isSub ClassO f(C, D ), isM emberOf (I, C) . The proof of is SubClassOf (convoy, theaterob ject) take s five st eps. 3 In gene r al, a very s low t e st m a y b e r un s eve ra l time s. To avoid t he r eev a luation of a t erm, e a ch time 3 1. isSubClassO f(conv oy, th eaterob ject) :- issubc lassof (convo y, thea terobj ect). (F A ILS) 2. isSubClas sOf(con voy, t heater object) :- issubc lassof (convo y, D), isSubC lassOf (D, th eaterob ject). 3. issubclas sof(con voy, m ilitar yunit). 4. isSubClas sOf(mil itaryu nit, t heatero bjec t) :- 16 an is SubClas sOf te rm is t ested, t h at term is asserted as a success or fa ilure . Then, the next time the t e r m need s t o be tested, the a n s we r is found in the new assertion, so it is not ne cessar y to run the full test again . Tabl e 19. Th e Code Mini m ization Algorit hm Base Case 1: IF an d THEN P is a buil t - in pr edi cat e (reserv ed ke yw o rd) i n Pro l o g, P is n o t findall , P is a satisfi able pred ic at e. Base Case 2: IF THEN P is a pred i cat e in a f act , P is a satisfi able pred ic at e. Base Case 3: IF an d THEN an d P is the predicate in t he head of a r u l e, R, each pred i cat e in R's b od y is P, P is a satisfi able pred ic at e, R i s a sat i sf iable ru l e. Inductive Case 1: IF an d THEN an d P is the predicate in t he head of a r u l e, R, ev er y pr edi cat e in R ' s body is sat i s fiable , P is a satisfi able pred ic at e, R i s a sat i sf iable ru l e. Inductive Case 2: IF an d an d THEN a rul e, R, has a t erm , T , in i t s body, wh ere T is assert(F) , asserta(F) , or assertz(F) , P is the predicate of F, all o f t he predic ates pr ecedin g T in the b o dy o f R a re satisfi able pred ic ates, P is a satisfi able pred ic at e. a. Inductive Case 3: IF an d THEN A is the second argum ent o f a findall , all o f t he predic ates in A are satisfi able pred ic ates, t h e findall is t reat ed as if i t was a satisfi able pred i cat e Base Case: IF THEN P is a pred i cat e that can be ca lle d f ro m o utsi de t h e ru l es, 4 P is a t es t able pred i cat e. Inductive Case 1: IF THEN findall is determi ned t o be a testabl e pred icate, each pred i cat e in P's seco nd argumen t is also testabl e. b. Inductive Case 2: IF an d THEN an d P is a pred i cat e such t hat P or not(P) i s f o und in t he body of a r ule , R, R's h ead can b e det er mi ned to have a testable pred i cat e, P is a t es t able pred i cat e, R i s a t est abl e ru l e. issubc lassof (milit aryunit , thea terobj ect). 5. issubc lassof (milit aryunit , thea terobj ec t). 4 These are the pred icates in que r ies, dy n amically asserted facts, a nd the c all to i n iti ate exte nsionalizat ion. 17 Avoiding r eev a luation of isS ubClassOf makes t he offline e xt en si onaliz ation process tractable , though it stil l takes more than 13 hours, a s shown in T able 17b. We a lso tr ied im p lementing t he a voiding r eev aluation technique on isMemberOf . But, fo r our task, very few ismemberof facts are known u ntil r untime , a nd the c ost of ove r head o ut weighs the b enef it, m a king extensionalization slowe r. 6.3.Minim izing Code Ano t he r efficiency improvement ca n b e impl em ented if certain knowledge i s available prio r to run t ime . G iven a list o f all o f t he pr edic ates t h at a re us ed in 1) the on tology, 2) th e dynam ic ch anges, and 3) the q uerie s, i t may b e p ossible to elim inate some of the rules, th us im pr oving e fficiency o f the e xt ension alization process . In addi t ion , the sa me t e chnique c an be used to el imin at e r ule s in the run time program. The ide a is t o f igure o ut which of the rul e s a re actuall y necessary, bec ause the unne cessar y rule s ca n be dropped , improv ing efficiency. If a r ule ca n neve r s ucce ssfull y fir e , the n it is unne c essar y. A lso , if no query will eve r r e sult in testing a r ule , then t hat rule is u nnece ssa ry. More pr ecisely, a rule is a necessary r ule only if it is both satis fiable a n d testable . To de t e r mine which r ules ar e sa tisfi able and t estable, it is nece s sar y t o figure out which pr edicate s ar e sa tisfi able a nd t e stabl e , respec t ively. T he al gorithm t hat define s sa tisfi able r ule s and predi ca t e s i s presented in Ta ble 19a, a n d T abl e 19b shows how t o de t ermine wh ic h r ule s a nd predi ca t e s a re t e stabl e . (In a ddi t i on , we w e r e able t o d rop m ore rul e s b y a ssu m ing t hat the knowledge base was alre ady consi st en t, el imin at ing the need to t e st for consi st en c y.) A fter removing all of the unnec e s sar y rule s, the extension alization proc e ss only took 6. 5 hours, as show n in T able 17c. And the online pr oce s ses can r un m uch fast er, bec ause t he Pr olog com p ile r can b e applie d to all o f t he pr edic ates that are not changed dynamically. T a ble 15c show s t hat it r eq uir es only 10 milli s econd s to a ssim ilat e the t wo dyn a mi c c h anges and 130 millise conds to answer t he t wo q u e r ie s. (T he dynamic changes and q u eri e s used in our e xperiments a re br iefly de s cribed ne ar the beginning o f S e ct ion 6.) These r esul ts sat isf y th e requi r eme n ts of o ur mili tar y task . 7. Rela ted Work Re cent r e search has a dd r e s sed similar issue s a nd pr oblems concerning the inte ra ction of Sem a n tic We b on t ology and r ule technologie s and logic prog ra mm ing. R el ated wo rk i ncl udes rese ar ch on a nswe r s e t progra mm i ng (E iter et al. 200 4; H e ym a ns & Ve r me ir 2003), disjunc t ive logic programming (Ma edche & Vo lz 2003; Minker & S e ipel 2002), c onstructive neg ation (Barták & Rom a n 1998), and D esc ript ion Logic Pr ogramm ing (DLP) (Grosof 2003). Howe ve r, we have not ye t had a n opportunity t o investigate this ot he r work eno ugh t o intelligen t ly comme nt on it. Our prelimin a ry expe rimentation with answe r s e t pr ogramming , howeve r , s eem s to demon st ra te across-the-bo a rd g ains in efficiency , c ompared t o o ur Prolog implemen tati on . But thi s wo rk is as ye t i n compl e t e. 8. Discu ss ion The S WORIER system , given ontologie s and r ule s, ser ve s a s an engine t hat r e s pond s t o que ries. T h is type o f w o r k will r e sult in a signifi cant enh a ncem ent to the S em a ntic Web, by provid ing a generally us eful s e rvice t o a ny a pplication t h at r e quires infor m a tion from t h e Sem a n tic Web. S WORIER is als o a men a ble t o dyna mi c c h anges, q u ickly assi mil ating new facts or re t ra cti ng ol d facts i n an o p erational se tt ing . Al t hough it c annot h a ndle dyn a m ic addi t ions, 18 dele t i on s, or modifi cations o f r ules a t this t ime , it can switch b e t wee n pr ede fined sets of r ules o n the fly. Pr e viously there has been little wo rk involving rule s a nd dyn a mi c change s. We h ave bu il t our work on t he f o undation deve loped in a paper written by Vol tz et al. (2003). We have addr essed five of the probl em s that thi s pa pe r suggested were u nsolv able. 1) B y defining logical negation in Prolog , wh ich m a ke s it possible t o satisfy the open world assum pt ion , it is now p ossible t o properly capt ure t he s em a n t ic s of compleme ntar y class e s , a s wel l a s di s joi nt cl asses. 2) D isj unction in t he he ad o f a rul e is ca ptured wi th t he us e of a new di s junctive operator. 3) Th e disj u n cti ve ope ra tor e nables the analysis of enume ra ted c lasses. 4) T hrough an o ffline analy s is of t he given ontologie s, S WORIER can autom at ically develop rul e s that enforce all and only t he give n car din a lity c on str ain ts. 5) Using a dif fer en t syntax to e xpress OWL facts in Pr olo g, add r e ssing pr ope rt ie s of equivalen t individual s h as been sim p lifie d. Al s o, we dealt wi th th r ee othe r issue s : duplicate facts, cy clical hie ra rchie s, and a nonymo us cl ass es. We have a lso introduced a ltern ative appr oache s f or dealing with inconsistencie s in t he given i nfo r m ation. When a n incon s istency is d iscove r ed , it is always p ossi bl e t o si m p ly s end an e rr o r me ss age t o t he develo per. Howeve r , f or many inconsist en cies, the possibility of fix ing th e problem autom a tically i s available . And, wi t h e xist en tial constraints a nd minimum cardin ality con stra in t s, t h is can b e done by addi ng new facts to the knowledge ba se or by applying th e skole mization method . W e h a ve not ye t conf irmed w hich o f the s e alt e rnatives is pr efe ra ble in which s ituations. W e expect t hat by in troducing pr agm a s (in str uction s/annotations to t h e knowledge compil ati on pr o cess), we ca n allow the develo p e r to choos e t he sp ec ific b eh avior he /s he w ants. Efficie ncy pr oblem s have b een a dd r essed t h rough 1) extension a lizat ion , which is a tabling m et hod that c onve rts a set of rul e s and facts into a set of facts, 2) a v oiding r eanaly sis, which saves r e sults t he f irst time they a re dete r mined t o a v oid r unning the sa me costly evaluation again , and 3) code minim ization, whi ch dele t e s r ule s that ar e unnecessary, for both offline and online pr ocessing . In our expe riments, the offline c om p ilation proce ss now c om p lete s in 6.5 hours, t w o dyna mi c c hange s ar e inc orpo ra te d int o t he knowledge ba se in 10 millisecond s, and two q ueries can be ans we r ed in only 130 mil lisecond s. In the futur e , we ho p e t o a nalyze a nd c onve rt the deve lope r's rules i n t o a ppropriate ly optim ized rules, perh aps via the use of r ew rit e r ule s a s for m agic se ts optimization and related rule t e chniques for logi c queries (Cadoli et al. 1999 ; Sippu & So isalon -S oininen 1996). (Se e Sec t ion 3.3.) Al so, t he ide as presen t ed in S e cti on 4 c oncerning m ult iple t e r m s in the he a d, eq ui v alent individuals, car di nalit y i ssues, c y clic hierachies, a nd a nonymous classes have not yet been implemen t ed . I n addit ion , there a re several pr imitives in OWL that a re not ye t impl em ented in SWORIE R, in c luding: cardi n ality, o r, and subPr o pe rtyOf, 5 and t he l og icNot predicate, introd u ced in Section 4.1 is only partially implemen ted. Ackn ow ledgment s The autho rs’ a ffi l iation wi th T he MITRE C o rporation i s pr ovided f or iden t ification pur pose s only , and is no t intende d to convey or imply MITRE's conc urr ence wi th, o r suppo rt fo r, the posi t ions, opinions or viewpoints expr e s sed by t he authors. We note t hat the views e xpr essed i n thi s pa p e r ar e those of t he authors a lone and do not r eflec t the official p o licy or position of a ny othe r org anization o r individ ual. 5 Th e other OWL primitiv es that ar e n o t y et implemented: AllDiffere nt , Datat ypeProperty , differ entFro m , distinct Member s , domain , eq uivale ntIndi vidual s , equivale nt- Proper ties , Functi onalPr operty , hasValue , Inverse Functio nalPro perty , max- Cardin ality , minCardi nality , range , sameAs , SymmetricP ropert y , and Transit ive- Proper ty . 19 Refe rences Ait- Kaci, Hassa n (1991), Warren's Abstr act Machine: A Tutorial Reconstruction , MIT Pr e ss, Serie s in Logic Pr og r a mming . Alsac¸ Gür ay & Ba ra l, Chi tta (2002) , "Reaso ning in D escripti on Logics U si ng D ecl ar ative Logic Pr o gramm ing", AAA I 2002. A MZI! (2006), "Amzi! P rolog+Logic Ser ve r, Adve n ture in Prolog Tutorial, Expe rt Sy stem s i n Pr o log , Fr eew a re, Article s, Source Code , Con su lting", http://www .a mz i.com / [ Acce s sed 12 Sep 2007]. Barták, Rom an (1998), "Constructive Neg ation and Constrain ts", http: //kti. m ff.cu ni.cz /~bar tak/c lp/downlo ads/ConstrNeg_EA . pdf [Acce ss ed 12 S e p 2007]. Be chhofer, S e a n, van Har melen , Frank , Hendle r , Jim , Horr o cks, Ian, M cGui nness, Deborah L., Pat e l- Schneider, P e te r F. & Ste i n , Lynn And r ea (2004), OWL Web On tology Language Refere nce , W3C, De a n, Mike & S ch r eibe r, Guus (ed s). http: // www .w3.org/TR/owl -ref/ [Acce ss ed 12 Sep 2007]. Cado li, Marco & Donini , France sco M. (1997), " A Survey on Knowledge Compilation" , AI Communications---The E uropean Journa l for Artificial Intelligence , 10 : 137-50. Cado li, M. , Pali pol i, L., Schae rf, A . & Vasile , D. (1999 ), "NP-SPEC: A n Ex e cutable Speci fication Lang ua ge f o r Sol ving all Pr oblem s in NP", Proc eedings of PADL'99 , pp. 16-30 . Also: LNC S 1551 , S p ringe r-Ve r lag [Online a t http: // www . dis.unirom a 1.it/pub/AI /pap ers/cado - e tal -99.ps.gz , acce ss ed 12 Sep 2007]. Cum bo, C h iara, Fa be r , Wol f gang , Gre co, Gianluigi & Leone , Nicola (2004), "Enh ancing the Magi c-Set Me t hod for Disj unctive Data log Pr og r am s ", ICLP 2004 , pp. 371-85 . Dacon ta, M., Obrst, L. & Sm ith, K. (2003), The Semant ic Web: The F uture of XML, Web Service s, and Knowle dge Manageme nt , John Wiley , I nc. June , 2003. Dar w iche , Adam & Marqui s, Pie r re (2002), "A Knowledge Compil a tion Map", Journa l of Artificial Intelligenc e Researc h (JAIR) , 17 :229- 64.[Online at http: // www . cs.ucla.ed u/~darwiche / d116.pd f , a cce ss ed 12 Se p 2007]. de Bruijn, Jos, P ol l e r e s, A xel, Lara, Ruben & F en sel , Dieter (2004), "WSML De live r able D20.3 v0.1 OWL Fli gh t ", WSML Worki ng Dra ft [Online a t http: // www . wsmo . o rg/2004/d20/d20.3/v0.1 , acce ss ed 12 Sep 2007]. Du, Ding zhu, Gu, Jun & Pardalo s, Pano s ( ed s ) (1997), Satisf iabili ty Problem : Theory and Applications , DIMA CS Serie s i n D iscre t e Matha m a tics a nd Theo r e tical Com put e r S cien c e , Ame r ican Ma the m a t ic al Society, Volume 35 . Eite r, Thom as, Lukasiew icz, T hom as, Schindl auer, R o m a n & T om p its, Hans (2004) "Com b ining An s we r S e t Pr og r amming w ith Descri ption Logics for the S em ant ic Web", Proceedings of the 9th International Conference on P rinciples of Kno w l edge Representation and Reasoning (KR'04) . Gogic , Goran, Ka utz , Hen r y A., Pap adimi t riou, C h ristos & S e l m a n, Bar t (1995) " T he Com par ative Lingui s t ic s of Knowledge R epre s entation" , Procee dings of the Fourtee nth International Joint Conference on Artificial Intelligenc e (IJCAI-95) , A AA I Press, pp. 862-9. Groso f, Benja m in N., Horrock s, Ian, Vol z, Ra phae l & Decke r, Ste fan (2003), "De scription L ogic Pr o gram s: Combining Logic Prog ra ms wi th Description Logi c", Proceedings of the Tw elfth International World Wide Web Conferenc e (WW W 200 3) , Bud a pe st, Hung a ry: ACM, May 20-23, 2003, pp. 48-57 . Heym a ns, St ijn & Verme ir, Dirk (2003), "In t egrating De s cription Logics and An s we r S e t Pr o gramm ing", Principles and Prac tice of Semantic Web Reasoning (P P SWR-03) , Lecture Notes in Computer Scienc e 2901 , Mum bai, India: Spr in ger Ve rla g, pp. 146-59. Hirtle , Da vid , Boley , Ha rol d, Dam asio, C arlo s , Gr oso f, Benj a min , Kife r, Mich a e l, Sin t ek , Mich ael, Tabet, Said & Wagne r , Gerd (2004), "Sche m a Spec ification of Rul e ML 0.87", http: // www . rulem l.org/0.87/ [Accessed 12 Sep 2007]. 20 Hitzle r, Pasc al, Studer, Rudi , S u re, York (2005), "De sc ription L ogic Pr og r ams: A Pra cti cal Choi ce for the Modelling of Ontologie s", http://www .a ifb.uni - karlsruhe .de/WBS/phi/pub/d lppos05.pd f [Accessed 12 Sep 2007]. Ho rr ock s, Ian, Pate l-Schneide r, Peter F., Boley , Harold, Tabet, Said , Gr o sof , Ben jamin & De an, Mike (2004), "SWRL: A Sem a ntic Web Rule La n guage Combining OW L a n d Rule ML", http: // www . daml.o rg/rules/proposal/ [Acce ss ed 12 S e p 2007]. Kautz, Hen ry & S e l m a n, Bar t (1994), "An E m p irical Evaluation o f Knowledge C om p ilation", P roceedings of the 12th National Confere nce of the Am erican Association for Artificial Intelligence , Se att le , WA , July 1994, MIT Press, pp. 15 5-61. Kautz, Hen ry A . & Selm a n, Bar t (1991), "A General Framewo r k fo r Knowledge Compilation" , P roceedings of the International Work shop on Proc essing Declarative Know ledge (PDK-91) , Richte r, H. & Ri ch t er, M. (ed s), Lecture Notes In Artific ial Intelligence 567 , Sp ringe r Verlag, pp. 287-300. [On li ne at www . cs .roches t er.edu/u/www / u/kautz/pap ers /kc-gen.ps , a cce ss ed 12 Sep 2007]. Maedche , A. & V olz , R (2003), "Optim izing Query Answe r ing in Desc ript ion Logics using Disj u nctive Deduc t ive Data base s", 10th International Workshop on Know ledge Represe ntation mee ts Databases ( KRDB-2003 ). Minke r , Ja ck & Sei pel, Dietm ar (2002), "Di sjunctive Logi c Pr o gramm ing: A Sur ve y and A ss e ss me n t ", Computational Logic : Logic Programm ing and Beyond , pp. 472-511. Re ctor, Al a n, Drummond , Nick, Ho rr idge , Mat the w , R oge rs, Jerem y , Kn ublauch, Holge r, Steve ns, Robe rt , Wa n g, Hai & Woe , Chris (2004), " OWL Pizz as: Practical Expe r ience of Teachin g OW L -DL: Common Errors & Comm on Pa tterns", 14th International Conference on Knowle dge Engineering and Know l edge Manage ment (EKAW ) , Whi t tlebury Hall , U K [Online at http: //www.co-ode . org /r eso ur ces/papers/ekaw 2004.pdf , a ccesse d 12 Sep 2007]. Schrag, R. & Craw fo rd, J. M. (1996) , "I m p licat e s a n d Prime I m p licate s I n Random 3S AT", Artificial Intelligenc e Journal , 81 :199- 222. A lso: F rontiers i n P robl em Solving: P hase Transitions and Complexity , Ho gg, T., Hube rman, B. A. & Wil l iam s, C. (ed s). [Online at http: // www . cirl .u oregon . ed u/crawfo r d/pape rs/implicates.ps , acce ss ed 12 Sep 2007]. Samue l, K en , Obr st, Leo , Stouten bur g, Suze tte, Fox, Kar e n, Frank lin, Pa ul, Jo hn s on, Ad rian, Laskey , K en , Nichol s, Deborah, Lopez , S teve & P e te rson, Ja son (2006), "Applyi ng Pr olog to Sem a n tic W e b Ontologie s & R ule s : Mov ing Toward De s cription Logic Prog ra m s ", P roceedings of the International Work shop on Applicat i ons of Logic P rogramming in the Semantic Web and Se mantic Web Service s , International Confe rence on Logic P rogramming , A u g ust 16, 2006. Se attle , Wa sh ington . 112-3. Poste r pre s entation and e xt ended a bstract. [Online at http: //sunsite .infor m a tik.rwth -aachen . de /Publication s/CE UR-W S/Vol- 196/alpsw s2006-po st e r5. pdf , a cce ss ed 12 Sep 2007]. Selm a n, Bart & K autz, Hen ry A. (1991), "Knowledge Com p ilation using Ho r n A pproximations", P roceedings of the Ninth National Con ference on Art ifi cial Intelligence (AAAI 91) , pp. 904-9, [Online at ww w .cs.roch ester.edu /u/www /u/kautz/pape rs /kc-horn.ps , a cce ss ed 12 Sep 2007]. Selm a n, Bart & K autz, Hen ry (1996), "Knowledge C ompil ation and T heo ry A pproxim a t ion" , Journal of the ACM , 43 (2):193- 224, M arch, 1996. Sippu, Se ppo & Soi salon-Soininen, Elj a s (1996), "A n An a lysis of Magic Se ts a nd Rel at ed Optimi zation Strat e gi e s f o r Lo gic Qu e ries", Journal of the ACM (JACM ) , 43 (6), 1046-88. Stouten bur g, Suzette, Obrst, Leo , Nichol s, D e borah, Samuel, Ken , La ske y, Ken , Johnson, Ad ria n, Pete rson, Ja son & F ox, Kare n (2006), "Ye ar 1 Re sults: Evaluating Propo sed A pproaches fo r a Sta n dard Sem a ntic We b Rule Lang ua ge" , MITRE Te chni cal Re p o rt 06b0000014. Stouten bur g, Suzette, Obrst, Leo , Nichol s, D e borah, Peterson , Jason & John s on, Ad r ian (2005), "Tow ar d a Stand a rd Rule Language for Sem a ntic Integration of the DoD En t e rpr ise ", W 3C Workshop on Rule Languages for Inte roperability , Apr il 2005, Washi ngt on , D.C., pp. 27-8. V an Roy, Peter L. (1990) , Can Logic Programming Ex ecute as Fast as Imperative P rogramming? , PhD the sis, D e pa rt me nt o f Computer Science , University of Ca li fornia, 21 Be rkeley, T e c hnical r e port no . UCB /CSD 90/600, U. C . Be r keley Comput e r Scie nce Divi s ion. Also: Fast Logic Program Ex ecution , In t ellect Book s. V an Roy, Peter & De spa in , Alvin M. (1992), "H igh-Perform a n ce Logic Pr o gramm ing wi t h the Aq uar ius Prolog Com pil e r", IEEE Computer , 25 (1):54- 68. V an Roy, Peter (1994), "The Wonde r Years o f Sequen t ial Prolo g Implemen ta tion", Journal of Logic Programming , 19 :385-441. [On li ne at ftp://ftp.di gital.com/pub/DEC/PRL/re s earch- repo r ts/P RL-RR-36.ps .Z, acce ss ed 12 Se p 2007]. Raphael Vo lz (2004), Web Ontology Reasoning w i th Logic Databases , Ph D the sis, AIFB , Unive rsity of Karlsruhe . Volz , R aphae l, Decke r, Ste fan & Obe rle, Daniel (2003), "Bubo - Impleme nting OWL in Rule- Based Syst em s ", http: //www . daml.o rg/ li st ar chive /j oint-commi tt ee/att-1254/01-bubo .pdf [Acce ss ed 12 Sep 2007].

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment