Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:2009:miw09_swrltrans:projekt [2009/05/29 16:37]
mikel
pl:miw:2009:miw09_swrltrans:projekt [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +~~ODT~~
 ====== SWRL_XML Intro ====== ====== SWRL_XML Intro ======
 SWRL_XML jest częścią projektu [[hekate:​heart|heart]]. Dlatego też przed uruchomieniem SWRL_XML należy ściągnąć i zainstalować program heart. SWRL_XML jest częścią projektu [[hekate:​heart|heart]]. Dlatego też przed uruchomieniem SWRL_XML należy ściągnąć i zainstalować program heart.
  
 ====== Pobierz ====== ====== Pobierz ======
-Download {{pl:​miw:​2009:​miw09_swrltrans:​swrl_xml.zip}}.+Download {{pl:​miw:​2009:​miw09_swrltrans:projekt:​swrl_xml.zip}}.
  
 ====== Wiadomości ====== ====== Wiadomości ======
Linia 11: Linia 12:
 ====== Uruchomienie ====== ====== Uruchomienie ======
 Plik swrl_xml.pl należy rozpakować do folderu, w którym jest zainstalowany heart (czyli tam gdzie m.in. plik heart.pl).\\ Plik swrl_xml.pl należy rozpakować do folderu, w którym jest zainstalowany heart (czyli tam gdzie m.in. plik heart.pl).\\
 +Należy załadować plik swrl_xml.pl. Spowoduje to automatyczne dołączenie plików heart.pl:
 +  ?- [swrl_xml].
  
 Należy załadować plik z regułami, np. therm-rt.pl wpisująć:​\\ Należy załadować plik z regułami, np. therm-rt.pl wpisująć:​\\
-[therm-rt].\\+  ?- [therm-rt].
  
 Generowanie XML uzyskuje się przez:\\ Generowanie XML uzyskuje się przez:\\
-swrl_xml_gen('​output.txt'​). % generowanie do pliku output.txt\\ +  ?- swrl_xml_gen('​output.txt'​). % generowanie do pliku output.txt 
-swrl_xml_gen. % generowanie w konsoli.+  ?​- ​swrl_xml_gen. % generowanie w konsoli.
  
 ====== Przykłady translacji ====== ====== Przykłady translacji ======
-therm-rt.pl+Sprawdzona poprawność składniowa wygenerowanych plików przez [[http://​www.w3.org/​2001/​03/​webdata/​xsv]]:​ 
 +   ​Validation was strict, starting with type [Anonymous] 
 +   ​schemaLocs:​ http://​www.w3.org/​2003/​11/​swrlx -> http://​www.ruleml.org/​swrl/​xsd/​swrlx.xsd 
 +   The schema(s) used for schema-validation had no errors 
 +   No schema-validity problems were found in the target 
 +  
 +===== therm-rt.pl ​===== 
 +Reguły w Heart (HMR): 
 + xrule ms/1: 
 +   [month in [january,​february,​december]] 
 +   ==> 
 +   [season set summer]. 
 + xrule ms/2: 
 +   [month in [march,​april,​may]] 
 +   ==> 
 +   [season set autumn] 
 +   :os. 
 + xrule ms/3: 
 +   [month in [june,​july,​august]] 
 +   ==> 
 +   [season set winter] 
 +   :os/3. 
 + xrule ms/4: 
 +   [month in [9,10,11]] %in [september,​october,​november]] 
 +   ==> 
 +   [season set winter] 
 +   :os.
  
-examples-rt.pl+ xrule dt/1: 
 +   [day in [monday,​tuesday,​wednesday,​thursday,​friday]] 
 +   ==> 
 +   [today set workday].%,
  
 + xrule dt/2:
 +   [day in [saturday,​sunday]]
 +   ==>
 +   [today set weekend].
 +   ​
 + xrule th/1:
 +   [today eq workday,
 +    ​hour ​ gt 17]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/2:
 +   [today eq weekend,
 +    ​hour ​ eq any]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/3:
 +   [today eq workday,
 +    ​hour ​ lt 9]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/4:
 +   [today eq workday,
 +    ​hour ​ in [9 to 17]]
 +   ==>
 +   [operation set during_bizhours].
 +
 + xrule os/1:
 +   [operation eq not_bizhours,​
 +    ​season eq summer]
 +   ==>
 +   [therm_set set 27].
 + xrule os/2:
 +   [operation eq during_bizhours,​
 +    ​season eq summer]
 +   ==>
 +   [therm_set set 24].
 + xrule os/3:
 +   [operation eq not_bizhours,​
 +    ​season eq spring]
 +   ==>
 +   [therm_set set 15].
 + xrule os/4:
 +   [operation eq during_bizhours,​
 +    ​season eq spring]
 +   ==>
 +   [therm_set set 20].
 + xrule os/5:
 +   [operation eq during_bizhours,​
 +    ​season eq winter]
 +   ==>
 +   [therm_set set 18].
 + xrule os/6:
 +   [operation eq not_bizhours,​
 +    ​season eq winter]
 +   ==>
 +   [therm_set set 14].
 + xrule os/7:
 +   [operation eq not_bizhours,​
 +    ​season eq autumn]
 +   ==>
 +   [therm_set set 16].
 + xrule os/8:
 +   [operation eq during_bizhours,​
 +    ​season eq autumn]
 +   ==>
 +   [therm_set set 20].
 +
 +Translacja na SWRL:
 +{{:​pl:​miw:​2009:​miw09_swrltrans:​projekt:​therm-rt-out.txt|}}
 +
 +
 +===== examples-rt.pl ===== 
 +Reguły w heart (HMR):
 +
 + xrule ms/1:
 +   [month in [january,​february,​december],​
 +    month in [ala,​ma,​kota]]  ​
 +   ==>
 +   [season set summer].
 + xrule ms/2:
 +   [month in [march,​april,​may]]
 +   ==>
 +   [season set autumn]
 +   :os.
 + xrule ms/3:
 +   [month in [june,​july,​august]]
 +   ==>
 +   [season set winter]
 +   **>
 +   [write(month)]
 +   :os/3.
 + xrule ms/4:
 +   [month eq 5]
 +   ==>
 +   [season set winter]
 +   :os.
 +
 + xrule dt/1:
 +   [day in [mon,​tue,​wed,​thr,​fri]]
 +   ==>
 +   [today set workday]
 +   **>
 +   [kot,​ma,​ale].
 + xrule dt/2:
 +   [day in [sat,sun]]
 +   ==>
 +   [today set weekend].
 +
 + xrule th/1:
 +   [today eq workday,
 +    hour gt 17]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/2:
 +   [today eq weekend,
 +    hour eq any]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/3:
 +   [today eq workday,
 +    hour lt 9]
 +   ==>
 +   [operation set not_bizhours].
 + xrule th/4:
 +   [today eq workday,
 +    ​hour ​ in [9 to 17]]
 +   ==>
 +   [operation set bizhours].
 +
 + xrule os/1:
 +   [operation eq not_bizhours,​
 +    ​season eq summer]
 +   ==>
 +   [therm_set set 27].
 + xrule os/2:
 +   [operation eq bizhours,
 +    ​season eq summer]
 +   ==>
 +   [therm_set set 24].
 + xrule os/3:
 +   [operation eq not_bizhours,​
 +    ​season eq spring]
 +   ==>
 +   [therm_set set 15].
 + xrule os/4:
 +   [operation eq bizhours,
 +    ​season eq spring]
 +   ==>
 +   [therm_set set 20].
 + xrule os/5:
 +   [operation eq bizhours,
 +    ​season eq winter]
 +   ==>
 +   [therm_set set 18].
 + xrule os/6:
 +   [operation eq not_bizhours,​
 +    ​season eq winter]
 +   ==>
 +   [therm_set set 14].
 + xrule os/7:
 +   [operation eq not_bizhours,​
 +    ​season eq fall]
 +   ==>
 +   [therm_set set 16].
 + xrule os/8:
 +   [operation eq bizhours,
 +    ​season eq fall]
 +   ==>
 +   [therm_set set 20].
 +
 +Translacja na SWRL:
 +
 +{{:​pl:​miw:​2009:​miw09_swrltrans:​projekt:​examples1-rt-out.txt|}}
 +
 +====== Propozycje rozszerzeń ======
 +  * Wprowadzenie predykatów obliczeń matematycznych binarnych: sin, cos, divide, pow, ...
 +  * Obsługa nielicznych predykatów n-arnych: add, multiply, ...
 +  * Utworzenie sztucznych dla SWRL tabel regułowych np.:
 +
 +    <​owlx:​Individual owlx:​name="​ms">​
 +        <​owlx:​ObjectPropertyValue owlx:​property="​rules">​
 +            <​owlx:​Individual>​
 +              <​owlx:​ObjectPropertyValue owlx:​property="​1"> ​
 +                <​owlx:​Individual owlx:​name="#​ms/​1/​1"​ /> 
 +              </​owlx:​ObjectPropertyValue>​
 +              <​owlx:​ObjectPropertyValue owlx:​property="​2"> ​
 +                <​owlx:​Individual owlx:​name="#​ms/​2/​1"​ /> 
 +              </​owlx:​ObjectPropertyValue>​
 +              (... reszta reguł ms/_/_ ...)
 +            </​owlx:​Individual>​
 +        </​owlx:​ObjectPropertyValue>​
 +                ​
 +        <​owlx:​ObjectPropertyValue owlx:​property="​link_from"> ​
 +            <​owlx:​Individual>​
 +             <​owlx:​ObjectPropertyValue owlx:​property="​1"> ​
 +                <​owlx:​Individual owlx:​name="#​month"​ /> 
 +             </​owlx:​ObjectPropertyValue>​
 +            </​owlx:​Individual>​
 +            ​
 +        </​owlx:​ObjectPropertyValue> ​
 +        <​owlx:​ObjectPropertyValue owlx:​property="​link_to"> ​
 +            <​owlx:​Individual>​
 +                <​owlx:​ObjectPropertyValue owlx:​property="​1"> ​
 +                    <​owlx:​Individual owlx:​name="#​season"​ /> 
 +                </​owlx:​ObjectPropertyValue>​
 +            </​owlx:​Individual>​
 +            ​
 +        </​owlx:​ObjectPropertyValue> ​
 +    </​owlx:​Individual>​
 +co odpowiadałoby zapisowi HMR:
 +  xschm ms: [month] ==> [season].
 +
 +====== Błędy ======
 +Zaimportowane predykaty z Vardy z pliku varda_xtt.pl do generowanie XML posiadają buga.
 +Predykat xml_tag_open/​3 w niektórych przypadkach zwraca więcej niż 1 rezultat.
 +Aktualna wersja obchodzi w pewien sposób ten błąd jednocześnie generując inny, mniej poważny (wybrałem "​mniejsze zło" ;-)).
 +
 +W generowanym SWRL XML zamiast wszystkich zmiennych <​ruleml:​var>​ pojawia się tylko pierwsza z nich.
 +
 +W podanych przykładach zamiast:
 +  <​ruleml:​var>​day</​ruleml:​var>​
 +powinno być:
 +    <​ruleml:​var>​day</​ruleml:​var>​
 +    <​ruleml:​var>​hour</​ruleml:​var>​
 +    <​ruleml:​var>​today</​ruleml:​var>​
 +    <​ruleml:​var>​operation</​ruleml:​var>​
 +    <​ruleml:​var>​month</​ruleml:​var>​
 +    <​ruleml:​var>​season</​ruleml:​var>​
 +    <​ruleml:​var>​therm_set</​ruleml:​var>​
  
pl/miw/2009/miw09_swrltrans/projekt.1243607849.txt.gz · ostatnio zmienione: 2019/06/27 15:57 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0