330 likes | 442 Views
Generating a Library of RuleML 1.0 Schemas. CS 6795 Semantic Web Techniques Team6: Hawra Bader Alseef Jeevan Reddy Kodur 19 Nov, 2012. Outline. Brief definition of: RuleML Derivation RuleML (sublanguages) Relax NG Compact schema Project Description . Use cases of the project .
E N D
Generatinga Library of RuleML 1.0 Schemas CS 6795 Semantic Web Techniques Team6: Hawra Bader Alseef Jeevan Reddy Kodur 19 Nov, 2012
Outline • Brief definition of: • RuleML • Derivation RuleML (sublanguages) • Relax NG Compact schema • Project Description. • Use cases of the project. • Explanation of project implementation: • Phase 1 • Phase 2 • Phase 3 • Phase 4 • Project results.
RuleML : • RuleML is a family of sublanguages whose root allows access to the language as a whole and whose members allow to identify customized subsets of the language. Therefore, RuleML's specification employs modular XML Schemas. • This was originally specified in Document Type Definitions (DTDs) [W3C98], then switched to XML Schema Definition Language (XSD) schemas. • Also this is developed to express both forward (bottom-up) and backward (top-down) rules in XML for deduction, rewriting, and further inferential-transformational tasks. • It is also defined by the Rule Markup Initiative, as an open network of individuals and groups from both industry and academia that was formed to develop a canonical Web language for rules using XML markup and transformations from and to other rule standards/systems. RuleML builds a hierarchy of rule sublanguages upon XML, RDF, XSLT, and OWL.
Derivation RuleML: The official model of the Derivation RuleML family of sublanguages. The model shows the sublanguages in top-down order where the most expressive sublanguage is shown at the top and generality decreases as we go down. A diamond-headed arrow indicates an aggregation association. datalogis part ofhornlog Regular-headed arrows indicate generalization as used for inheritance. bindatalogis adatalog The composition may happen directly (datalog) , or indirectly through subsequent associations. (bindatalog is not directly associated with any modules, but with some modification it inherits them ) A solid line indicates distinct from the standard aggregation relationship.
The RuleML 1.0 schemas in Relax NG compact : • The benefits of a re-engineering and re-conceptualization of the non-SWSL portion of the Derivation Rules subfamily of RuleML in Relax NG Compact schemas are: • decreased positional sensitivity. • greater flexibility in modularization. • unification of human-readable and machine-readable versions.
Project Description: • The project is about generating a library of RuleML 1.0 schemas where the desired schema should be in the Relax NG Compact (RNC) form. • The RuleML 1.0 schemas in Relax NG consist of a ‘backbone’ of named schemas enriched by a large number of parameter-defined schemas customizable via a schema generator, MYNG. • By using the MYNG tool, the Library of relevant RuleML 1.0 sublanguages in RNC will be built which then shall be tested and illustrated with some sample instances. • The library should be available online.
The use cases of the project: • We mainly have accomplished the project by employing 3 use cases of different sublanguages. • Horn Logic • Ground Logic • Ground Fact • Horn Logic: According to IgorMozetic on W3C RIF-WG Wiki: Horn Logic is a formal language, which has a corresponding inference procedure, thus forming a formal system together. The formal language allows to express rules (and facts), and queries. The inference procedure computes answers to queries from rules (and facts). • Ground Logic and Ground Fact: In mathematical logic, a ground term of a formal system is a term that does not contain any free variables.
Phase 1: creating RNC schemas by using MYNG tool. • To do this phase, we open the page MYNG that was built in PHP and select the checkboxes for Hornlog and binary and we refresh the schema. Then, there will be a link of a new URL generated that is the RNC schema for the checkboxes we selected. When we click on that link, we can see custom_driver.rnc file generated related to our binaryhornlogic. This way we generate different Relax NG Compact for different sublanguages such as polyadic ground fact and polyadic ground logic sublanguage. • MYNG generating rnc schema screen shot:
Phase 2: creating exampls for Binary Horn Logic Schema. Example[1] : Sample RuleML to show Horn Logic Binary relation. if "a number of customer uses parking lot has vehicle of car type", then "parking fee for the customer per hours parked would be in increments of 1 Dollar"
XML Example For Binary Horn Logic Schema. <?xml-modelhref="http://ruleml.org/1.0/relaxng/schema_rnc.php?backbone=xf&default=x7&termseq=x2&lng=x1&propo=x3ff&implies=x7&terms=xf3f&quant=x3&expr=xf&serial=xf" type="application/relax-ng-compact-syntax" charset="UTF-8" ?><RuleMLxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ruleml.org/spec" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <Atom> <Rel>parking fee</Rel> <Ind>Chown and Hanson</Ind> <Ind>time</Ind> <slot> <Expr> <Fun>duration</Fun> </Expr> <Data>vehicle class</Data> </slot> </Atom> </Assert> <Query node="#query1"> <And> <Atom> <Rel>relation</Rel> <Ind>customer_1</Ind> <Var>customer_1 name</Var> </Atom> <Atom> <op> <Rel>another relation</Rel> </op> <Ind>car list</Ind> <Ind>rates</Ind> </Atom> </And> </Query></RuleML> <Assert><Implies> <then> <Atom> <Rel>parking fee</Rel> <Var>customer</Var> <Var>hoursparked</Var> <slot> <Expr type="incremental"> <Fun>Dollar</Fun> </Expr> <Data>1</Data> </slot> </Atom> </then> <if> <And> <Atom> <Rel>paid parking lot</Rel> <Var>customer</Var> <Ind>number</Ind> </Atom> <Atom> <Rel>vehicle</Rel> <Var>car</Var> <Ind>type</Ind> </Atom> </And> </if> </Implies>
Phase 3: • Creating sample instances for Relax NG Compact Schemas. • Polyadic Ground Logic Schema. • Polyadic Ground Fact Schema.
Examples of Polyadic Ground Logic Schema. Example 1: Sample RuleML to show Ground Logic Polyadicrelation. if "books can be hardbound or softbound, and books can be informative or fun" then "an encyclopedia, a dictionary, and a novel are books"
XML example For Polyadic Ground Logic Schema. <?xml-modelhref="http://ruleml.org/1.0/relaxng/schema_rnc.php?backbone=x3&default=x7&termseq=x7&lng=x1&propo=x3ff&implies=x7&terms=xf3f&quant=x1&expr=x0&serial=xf" type="application/relax-ng-compact-syntax" charset="UTF-8” ?> <RuleMLxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ruleml.org/spec" xmlns:xs="http://www.w3.org/2001/XMLSchema"><Assert mapDirection="forward" mapClosure="universal"><Implies> <then> <Atom> <op> <Rel>book</Rel> </op> <Ind>encyclopedia</Ind> <Ind>dictionary</Ind> <Ind>novel</Ind> </Atom> </then> <if> <And> <Atom> <op> <Rel>book</Rel> </op> <Ind>informative</Ind> <Ind>relaxing</Ind> </Atom> <Atom> <op> <Rel>book</Rel> </op> <Ind>hardbound</Ind> <Ind>softbound</Ind> </Atom> </And> </if> </Implies> </Assert></RuleML>
Examples of Polyadic Ground Fact Schema. Example 1: Sample RuleML to show Ground Fact Polyadic relation. • sample web browser type include webkits (ex. Google Chrome) and mobile (ex. Opera); • social networking sites include Facebook, Twitter, and Google Plus; • sample instant messengers include Skype and Yahoo! Messenger
XML example For Polyadic Ground Fact Schema. <?xml-model href="RuleML%20files/Ground%20Fact%20Polyadic.rnc" type="application/relax-ng-compact-syntax"?> <RuleMLxmlns="http://ruleml.org/spec" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Query> <Atom> <op> <Rel>webbrowsers</Rel> </op> <slot> <Ind>webkit</Ind> <Ind>GoogleChrome</Ind> </slot> <slot> <Ind>mobile</Ind> <Ind>Opera</Ind> </slot> </Atom> <Atom> <op> <Rel>socialnetworkingsites</Rel> </op> <Ind>Facebook</Ind> <Ind>Twitter</Ind> <Ind>GooglePlus</Ind> </Atom> </Query> <Assert node="#assert1"> <Atom> <op> <Rel>instantmessengers</Rel> </op> <slot> <Ind>Skype</Ind> <Ind>Yahoo!Messenger</Ind> </slot> </Atom> </Assert></RuleML>
Phase 4: Documenting in an online directory all the files in a directory and subdirectories. • We answered three different type of questions in each sublanguage by creating some examples to each of them in binary hornlogic, polyadic ground fact, polyadicgroundlogic. The focus of this phase is the documentation of all results in an online directory. Here we try to make all the files available in an online directory. But first we try to create a new webpage which is needed to keep all the files in the form of directory so we have created a webpage with the url as http://generateruleml-1-library.xp3.biz/.
This below diagram shows the actual home webpage. We can see in this webpage there is a directory of folders in the starting where we have two main directories as RuleML Files and other one as Relax NG Compact Schemas. When we click on the RuleML Files it shows a new page where it has information about the different types of sublanguages we have included.
The below page shows the different sublanguages in an order. Further we can see that the different sublanguages over here behave as a different subdirectories which have few ruleml example files under them. All these example files can be seen when once we click on a particular sublanguage and below we can see the binaryhornlog example files opened.
The webpage shown below is for binary horn logic subdirectory, similarly we can see for all other subdirectories. So in the next level when we click on a particular ruleml example file we can see that the particular ruleml file gets opened where we can see the code written over there.
When we move back again to the actual home page we see that we have one more directory as Relax NG Compact Schemas here when we click on this we see that the next page opens which has the different RNC files for our particular sublanguages and one more subdirectory named as modules. When you click on modules we can see further another file system which has different files used in our validation of our sublanguages. Below we can see these two webpages in a screenshot.
We finally run these sublanguage examples in oxygen or validator.nu accordingly and test whether the documents are valid or not accordingly. Below we show the screenshot of validator.nu.
Project results. • In particular, the library of RuleML 1.0 schemas has built with specific sublanguages, which are Horn Log, Ground Logic and Ground Fact. • We can compare these three sublanguages in terms of expressiveness.
Based on what we have implemented, we can illustrate the level of expressiveness of three sublanguages by the figure below.
The figure shows the sublanguages in bottom-up order where the most expressive sublanguage is shown at the bottom. It shows that Datalog sublanguage is at the bottom and as we mentioned earlier that Datalog is a part of Horn Log, we can infer that: Horn Log is the most expressive sublanguage among them where It includes implications (rules), relations, quantifications (Forall, Exists) and functions <Expr> as well.
The second sublanguage is Ground Logic where it is more expressive than Ground Fact because implications (rules) are allowed as well as relations. It contains more possibilities such as ( Ind, Skolem, Data, Reify, Arg, Slot, etc ) but does not contain Var. • The third sublanguage is Ground Fact where it just contains relations and constants, (no implications or quantifiers).
References: • http://ruleml.org/modularization/#pr • http://www.w3.org/2005/rules/wg/wiki/Horn_Logic • http://en.wikipedia.org/wiki/Ground_expression • http://ruleml.org/0.85/ooruleml-remodularized_schematized.pdf • http://www.cs.unb.ca/~boley/papers/RuleMLinRelaxNG.pdf • http://ruleml.org/1.0/relaxng/