SlideShare a Scribd company logo
1 of 29
Download to read offline
Introduction
      The API Structure and Functionality
            Conclusion and Future Work




  PSOA RuleML API: A Tool for Processing
     Abstract and Concrete Syntaxes

  Mohammad Sadnan Al Manir1 Alexandre Riazanov1
       Harold Boley2 Christopher J.O. Baker1

        1 Department   of Computer Science and Applied Statistics
            University of New Brunswick, Saint John, Canada
             2 Information  and Communications Technologies
                      National Research Council Canada


The 6th International Symposium on Rules: Research Based
           and Industry Focused (RuleML-2012)

                        Sadnan Al Manir     PSOA RuleML API
Introduction
             The API Structure and Functionality
                   Conclusion and Future Work


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Introduction
                                                   PSOA RuleML and the API
             The API Structure and Functionality
                                                   Motivation
                   Conclusion and Future Work


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Introduction
                                               PSOA RuleML and the API
         The API Structure and Functionality
                                               Motivation
               Conclusion and Future Work


PSOA RuleML



    An object-relational Web rule language
    Unlike F-logic and W3C RIF, PSOA RuleML defines
        Objects (frames) uniformly with relations
    Permits relation applications with
        Optional Object IDentifiers (OIDs) and
        Positional and Slotted arguments
    Allows positional-slotted object-applicative (psoa) terms and
    rules




                           Sadnan Al Manir     PSOA RuleML API
Introduction
                                                          PSOA RuleML and the API
                The API Structure and Functionality
                                                          Motivation
                      Conclusion and Future Work


PSOA Rules Exemplified

  Example (Rule-defined anonymous family frame)
  Group is used to collect a rule and two facts. Forall quantifier
  declares original universal argument variables and generated
  universal OID variables ?2, ?3, ?4. Infix :- separates conclusion
  from premises of rule, which derives anonymous/existential family
  frame from married relation And from kid relation of husb Or
  wife (the left-hand side is objectified on the right).

  Group (                                             Group (
   Forall ?Hu ?Wi ?Ch (                                Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 (
                                                        Exists ?1 (
    family(husb->?Hu wife->?Wi child->?Ch) :-            ?1#family(husb->?Hu wife->?Wi child->?Ch)) :-
     And(married(?Hu ?Wi)                                 And(?2#married(?Hu ?Wi)
         Or(kid(?Hu ?Ch) kid(?Wi ?Ch))) )                     Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) )
   married(Joe Sue)                                    _1#married(Joe Sue)
   kid(Sue Pete)                                       _2#kid(Sue Pete)
        )                                                   )



                                  Sadnan Al Manir         PSOA RuleML API
Introduction
                                                PSOA RuleML and the API
          The API Structure and Functionality
                                                Motivation
                Conclusion and Future Work


The API at a Glance



     Open-source at
     http://code.google.com/p/psoa-ruleml-api/
     Allows factory-based Abstract Syntax Object (ASO) creation
     and manipulation
     Parses XML-based concrete PSOA RuleML syntax
     Translates ASOs into RIF-like Presentation Syntax (PS)




                            Sadnan Al Manir     PSOA RuleML API
Introduction
                                                   PSOA RuleML and the API
             The API Structure and Functionality
                                                   Motivation
                   Conclusion and Future Work


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Introduction
                                                PSOA RuleML and the API
          The API Structure and Functionality
                                                Motivation
                Conclusion and Future Work


Motivation



     Java API facilitates creating software using PSOA
         Enables PSOA adoption
     Creating Rule-based applications such as
         Rule authoring
         Rule engines
     To be used in a Clinical Intelligence project (HAIKU)
         Semantic modeling of Relational Databases
         Automatic generation of Semantic Web services




                            Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                  Introduction
                                                  Construction of Abstract Syntax Objects
            The API Structure and Functionality
                                                  Abstract Syntax Structure Traversal
                  Conclusion and Future Work
                                                  Parsing and Rendering


API Components


  Two main components
      Classes for creating and traversal of ASOs
           AbstractSyntax: Top level class containing interfaces for
           ASOs
           DefaultAbstractSyntax: Implements these interfaces
      Classes for parsing and rendering
           Validator: Validates input, calls rendering methods
           Parser: Parses PSOA/XML input using Java Architecture for
           XML Binding (JAXB)




                              Sadnan Al Manir     PSOA RuleML API
Package Organization
                               Introduction
                                               Construction of Abstract Syntax Objects
         The API Structure and Functionality
                                               Abstract Syntax Structure Traversal
               Conclusion and Future Work
                                               Parsing and Rendering


The API Structure




           Figure: Main Components of the API Structure

                           Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


How to Create a Factory?



  Code Snippet
  // Initialize Validator
  Validator v = new Validator();
  // Initialize Parser
  Parser p = new Parser();
  // PSOA/XML input file to be parsed
  File file = new File("family.psoa");
  // Factory creation
  DefaultAbstractSyntax absSynFactory = new DefaultAbstractSyntax();
  // Parsing of input document using JAXB
  AbstractSyntax.Document doc = p.parse(file, absSynFactory);




                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Construction of Facts

       CreateX methods are used for ASO construction
       A fact is of type Atomic (e,g., Atom, Equal, Subclass)
       Example of an Atom _1#married(Joe Sue)
          - Joe and Sue are in a married relation with the OID _1

  Creating Constants _1, married, Joe and Sue
  Const_Constshort const_1 = absSynFactory.createConst_Constshort("_1")
  Const_Constshort const_married = absSynFactory
                                         .createConst_Constshort("married")
  Const_Constshort const_Joe = absSynFactory
                                         .createConst_Constshort("Joe")
  Const_Constshort const_Sue = absSynFactory
                                                    .createConst_Constshort("Sue")



                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Construction of Facts (Cont’d)
  Adding positional terms const_Joe and const_Sue in a list of
  tuples
  LinkedList<AbstractSyntax.Term> tuplesList
                                 = new LinkedList<AbstractSyntax.Term>();

  // iterate through all positional terms
  for (Object obj : tuple.getTERM()) {
    // check if the term is a variable
    if (obj instanceof Var) {
      tuplesList.addLast((Var) obj);
    }
    // check if the term is a constant
    else if (obj instanceof Const) {   // as a refinement of Const, the
      tuplesList.addLast((Const) obj); // short constants const_Joe and
    }                                  // const_Sue are added to tuplesList
    else if (obj instanceof Expr) {
      tuplesList.addLast((Expr) obj);
    }
  ...
  }
                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                    Introduction
                                                    Construction of Abstract Syntax Objects
              The API Structure and Functionality
                                                    Abstract Syntax Structure Traversal
                    Conclusion and Future Work
                                                    Parsing and Rendering


Construction of Facts (Cont’d)

  Creating a list of tuples const_Joe and const_Sue
  Tuple tuples = absSynFactory.createTuple(tuplesList)


  Assembling _1, married and tuples into a psoaTerm
  // null indicates absence of slots
  Psoa psoaTerm = absSynFactory
                                 .createPsoa(const_1, const_married, tuples, null)


  Creating a fact of type Atom
  Atom atom = absSynFactory.createAtom(psoaTerm)


       CreateSubclass, CreateEqual methods are used for facts of
       type Subclass, Equality

                                Sadnan Al Manir     PSOA RuleML API
Package Organization
                                  Introduction
                                                  Construction of Abstract Syntax Objects
            The API Structure and Functionality
                                                  Abstract Syntax Structure Traversal
                  Conclusion and Future Work
                                                  Parsing and Rendering


Construction of Rules


      A Rule contains Condition and Conclusion
      The Condition of the following Rule consists of
           A Conjunction of the atomic formula
               - ?2#married(?Hu ?Wi) and
           Disjunction of two atomic formulas
               - ?3#kid(?Hu ?Ch) and ?4#kid(?Wi ?Ch)

    Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 (
       Exists ?1 (
           ?1#family(husb->?Hu wife->?Wi child->?Ch)) :-
                 And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch)))
    )




                              Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Construction of Rules (Cont’d)
       Creating Condition formula
         And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch)))

  Atom ?3#kid(?Hu ?Ch) as atomOr_1
  Var var_3 = absSynFactory.createVar("3")
  ...
  Tuple tuples = absSynFactory.createTuple(tuplesList_1)
  Psoa psoaTerm_1 = absSynFactory
                               .createPsoa(var_3, const_kid, tuples, null)
  Atom atomOr_1 = absSynFactory.createAtom(psoaTerm_1)


  Atom ?4#kid(?Wi ?Ch) as atomOr_2
  Atom atomOr_2 = absSynFactory.createAtom(psoaTerm_2)


  Disjunction of two Atoms as a formulaOrList
  Formula_Or formula_Or = absSynFactory.createFormula_Or(formulaOrList)

                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Construction of Rules (Cont’d)


       Creating Condition formula
         And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch)))


  Atom ?2#married(?Hu ?Wi) as atom_And
  Atom atom_And = absSynFactory.createAtom(psoaTerm_3)


  Conjunction of atom_And and formula_Or as a formulaAndList
  Formula_And formula_And = absSynFactory
                                       .createFormula_And(formulaAndList)




                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                      Introduction
                                                      Construction of Abstract Syntax Objects
                The API Structure and Functionality
                                                      Abstract Syntax Structure Traversal
                      Conclusion and Future Work
                                                      Parsing and Rendering


Construction of Rules (Cont’d)
       Creating Conclusion formula
        Exists ?1 (
            ?1#family(husb->?Hu wife->?Wi child->?Ch))


  psoa term from variables, constants, 3 slots as a slotsList
  Var var_1 =    absSynFactory.createVar("1")
  ...
  Slot slot_1    = absSynFactory.createSlot(const_husb, var_Hu)
  Slot slot_2    = absSynFactory.createSlot(const_wife, var_Wi
  Slot slot_3    = absSynFactory.createSlot(const_child, var_Ch)
  Psoa psoa = absSynFactory.createPsoa(var_1, const_family, null,slotsList)


  Conclusion with existentially quantified variable ?1 as a
  varsListExists
  Head rule_head = absSynFactory.createHead(varsListExists, atom_head)

                                  Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Construction of Rules (Cont’d)
       Creating Rule with the Condition and Conclusion formula
     Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 (
        Exists ?1 (
            ?1#family(husb->?Hu wife->?Wi child->?Ch)) :-
                  And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch)))
     )


  Implication from Condition and Conclusion
  Implies implication = absSynFactory.createImplies(rule_head,formula_And)


  Clause (Either an Implication or an Atomic formula)
  Clause clause = absSynFactory.createClause(implication)


  Rule with universally quantified variables as a varsListUniv
  Rule rule = absSynFactory.createRule(varsListUniv, clause)

                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                Introduction
                                                Construction of Abstract Syntax Objects
          The API Structure and Functionality
                                                Abstract Syntax Structure Traversal
                Conclusion and Future Work
                                                Parsing and Rendering


Traversal of ASOs

     Data structures representing PSOA expressions can be
     processed by simple recursive traversal
     All components of the structures can be accessed by the getX
     accessor methods
     General classes (see earlier Figure)
         are Sentence, Formula, Atomic, Term, Const, and Expr
         contain isX methods to recognize the specific instance types
     Specific classes of particular instances have to be identified by
     using instanceof
     Both ways are legitimate
     e.g., for an Atomic formula, an isX method in Atomic class
     needs to recognize if the instance is of type Atom, Subclass,
     or Equal object
                            Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Traversal of ASOs (Cont’d)
       isEqual method in general class Atomic
             recognizes the instance of Equality Atom
             ?cost = "47.5"∧∧ xs:float
             immediately, makes a cast as the instance type Equal
             calls getLeft and getRight methods
  Traversing Equality Atom ?cost = "47.5"∧∧ xs:float
  assert this instanceof AbstractSyntax.Equal
  return (AbstractSyntax.Equal) this
  ...
  AbstractSyntax.Term getLeft()
  AbstractSyntax.Term getRight()

       The methods getLeft (?cost) and getRight
       ("47.5"∧∧ xs:float) refer to instances of other general class
       Term
             which uses isVar, isConstLiteral, isConstShort to recognize
             variables and constants
                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                   Introduction
                                                   Construction of Abstract Syntax Objects
             The API Structure and Functionality
                                                   Abstract Syntax Structure Traversal
                   Conclusion and Future Work
                                                   Parsing and Rendering


Outline


  1   Introduction
         PSOA RuleML and the API
         Motivation

  2   The API Structure and Functionality
        Package Organization
        Construction of Abstract Syntax Objects
        Abstract Syntax Structure Traversal
        Parsing and Rendering

  3   Conclusion and Future Work



                               Sadnan Al Manir     PSOA RuleML API
Package Organization
                                        Introduction
                                                        Construction of Abstract Syntax Objects
                  The API Structure and Functionality
                                                        Abstract Syntax Structure Traversal
                        Conclusion and Future Work
                                                        Parsing and Rendering


Parsing and Rendering as Presentation Syntax

          Parsing: JAXB is used to generate the XML Parser
                 which creates Java classes by binding a schema
          Rendering: PSOA/XML Fact transformed into PSOA/PS
 <Atom>
   <Member>
     <instance>
        <Const type="&psoa;iri">inst1</Const>
     </instance>
     <class>
        <Const type="&psoa;iri">family</Const>
     </class>
   </Member>
                                                           inst1#family(Joe Sue Child->Pete)
   <tuple>
     <Const type="&psoa;iri">Joe</Const>
     <Const type="&psoa;iri">Sue</Const>
   </tuple>
   <slot>
     <Const type="&psoa;iri">Child</Const>
     <Const type="&psoa;iri">Pete</Const>
   </slot>
 </Atom>


                                    Sadnan Al Manir     PSOA RuleML API
Introduction
          The API Structure and Functionality
                Conclusion and Future Work


Summary



    Inspired by the OWL API and Jena API
    The API is open-source and hosted in [1]
    Currently the API renders PSOA/XML only as PSOA/PS
    The reference translator PSOA2TPTP [2] is pursued in a
    companion effort
          Interoperates PSOA RuleML with TPTP Reasoners




                            Sadnan Al Manir     PSOA RuleML API
Introduction
          The API Structure and Functionality
                Conclusion and Future Work


Future Work




     Translation of ASOs back to PSOA/XML
     Merge the API with PSOA2TPTP
     Deploy for semantic modeling of Relational Databases in a
     Clinical Intelligence project
         Semantic mapping of Relational Databases to Ontologies




                            Sadnan Al Manir     PSOA RuleML API
Introduction
             The API Structure and Functionality
                   Conclusion and Future Work


References



  [1] Al Manir, M.S., Riazanov, A., Boley, H. and Baker, C.J.O.
      PSOA RuleML API: A Tool for Processing Abstract and
      Concrete Syntaxes
      http://code.google.com/p/psoa-ruleml-api/.
  [2] Zou, G., Peter-Paul, R., Boley, H. and Riazanov, A.
      PSOA2TPTP: A Reference Translator for Interoperating
      PSOA RuleML with TPTP Reasoners.
      In RuleML-2012 proceedings




                               Sadnan Al Manir     PSOA RuleML API

More Related Content

Similar to PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes

awSOA: Agents-based SOA for Wireless Sensor & Actor Networks
awSOA: Agents-based SOA for Wireless Sensor & Actor NetworksawSOA: Agents-based SOA for Wireless Sensor & Actor Networks
awSOA: Agents-based SOA for Wireless Sensor & Actor Networks
Juan Antonio Martin Checa
 
Soa admin training
Soa admin trainingSoa admin training
Soa admin training
Anil Ncodeit
 

Similar to PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes (20)

FraSCAti Adaptive and Reflective Middleware of Middleware
FraSCAti Adaptive and Reflective Middleware of MiddlewareFraSCAti Adaptive and Reflective Middleware of Middleware
FraSCAti Adaptive and Reflective Middleware of Middleware
 
Oracle soa online training in uk,usa and india
Oracle soa online training in uk,usa and indiaOracle soa online training in uk,usa and india
Oracle soa online training in uk,usa and india
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
An Approach to Recover Feature Models From Object-Oriented Source Code
An Approach to Recover Feature Models From Object-Oriented Source CodeAn Approach to Recover Feature Models From Object-Oriented Source Code
An Approach to Recover Feature Models From Object-Oriented Source Code
 
Introduction to Django Rest Framework
Introduction to Django Rest FrameworkIntroduction to Django Rest Framework
Introduction to Django Rest Framework
 
Drf
DrfDrf
Drf
 
Raml
RamlRaml
Raml
 
Fundamental essentials for api design
Fundamental essentials for api designFundamental essentials for api design
Fundamental essentials for api design
 
Fundamental essentials for api design
Fundamental essentials for api designFundamental essentials for api design
Fundamental essentials for api design
 
Fundamental Essentials for API Design
Fundamental Essentials for API DesignFundamental Essentials for API Design
Fundamental Essentials for API Design
 
Sakai Overview 06-2004
Sakai Overview 06-2004Sakai Overview 06-2004
Sakai Overview 06-2004
 
5 Killer Tools You Need for a Stellar API-First Workflow.pptx
5 Killer Tools You Need for a Stellar API-First Workflow.pptx5 Killer Tools You Need for a Stellar API-First Workflow.pptx
5 Killer Tools You Need for a Stellar API-First Workflow.pptx
 
awSOA: Agents-based SOA for Wireless Sensor & Actor Networks
awSOA: Agents-based SOA for Wireless Sensor & Actor NetworksawSOA: Agents-based SOA for Wireless Sensor & Actor Networks
awSOA: Agents-based SOA for Wireless Sensor & Actor Networks
 
Using the RFC 7575 and Models at Runtime for Enabling Autonomic Networking in...
Using the RFC 7575 and Models at Runtime for Enabling Autonomic Networking in...Using the RFC 7575 and Models at Runtime for Enabling Autonomic Networking in...
Using the RFC 7575 and Models at Runtime for Enabling Autonomic Networking in...
 
More Coverage, Better Diagnostics
More Coverage, Better DiagnosticsMore Coverage, Better Diagnostics
More Coverage, Better Diagnostics
 
API Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rantAPI Docs Made Right / RAML - Swagger rant
API Docs Made Right / RAML - Swagger rant
 
From SOA to SCA and FraSCAti
From SOA to SCA and FraSCAtiFrom SOA to SCA and FraSCAti
From SOA to SCA and FraSCAti
 
Toward Automatic Generation of SPARQL result set Visualizations
Toward Automatic Generation of SPARQL result set VisualizationsToward Automatic Generation of SPARQL result set Visualizations
Toward Automatic Generation of SPARQL result set Visualizations
 
Soa admin training
Soa admin trainingSoa admin training
Soa admin training
 
Soa admin training
Soa admin trainingSoa admin training
Soa admin training
 

More from RuleML

A software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasksA software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasks
RuleML
 

More from RuleML (20)

Aggregates in Recursion: Issues and Solutions
Aggregates in Recursion: Issues and SolutionsAggregates in Recursion: Issues and Solutions
Aggregates in Recursion: Issues and Solutions
 
A software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasksA software agent controlling 2 robot arms in co-operating concurrent tasks
A software agent controlling 2 robot arms in co-operating concurrent tasks
 
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
Port Clearance Rules in PSOA RuleML: From Controlled-English Regulation to Ob...
 
RuleML 2015: Ontology Reasoning using Rules in an eHealth Context
RuleML 2015: Ontology Reasoning using Rules in an eHealth ContextRuleML 2015: Ontology Reasoning using Rules in an eHealth Context
RuleML 2015: Ontology Reasoning using Rules in an eHealth Context
 
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
RuleML 2015: Semantics of Notation3 Logic: A Solution for Implicit Quantifica...
 
Rule Generalization Strategies in Incremental Learning of Disjunctive Concepts
Rule Generalization Strategies in Incremental Learning of Disjunctive ConceptsRule Generalization Strategies in Incremental Learning of Disjunctive Concepts
Rule Generalization Strategies in Incremental Learning of Disjunctive Concepts
 
RuleML 2015 Constraint Handling Rules - What Else?
RuleML 2015 Constraint Handling Rules - What Else?RuleML 2015 Constraint Handling Rules - What Else?
RuleML 2015 Constraint Handling Rules - What Else?
 
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
RuleML2015 The Herbrand Manifesto - Thinking Inside the Box
 
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and RulesRuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
RuleML2015 PSOA RuleML: Integrated Object-Relational Data and Rules
 
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
Industry@RuleML2015: Norwegian State of Estate A Reporting Service for the St...
 
A Service for Improving the Assignments of Common Agriculture Policy Funds to...
A Service for Improving the Assignments of Common Agriculture Policy Funds to...A Service for Improving the Assignments of Common Agriculture Policy Funds to...
A Service for Improving the Assignments of Common Agriculture Policy Funds to...
 
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
Datalog+-Track Introduction & Reasoning on UML Class Diagrams via Datalog+-
 
RuleML2015: Binary Frontier-guarded ASP with Function Symbols
RuleML2015: Binary Frontier-guarded ASP with Function SymbolsRuleML2015: Binary Frontier-guarded ASP with Function Symbols
RuleML2015: Binary Frontier-guarded ASP with Function Symbols
 
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge PlatformsRuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms
 
RuleML2015: Rule-Based Exploration of Structured Data in the Browser
RuleML2015: Rule-Based Exploration of Structured Data in the BrowserRuleML2015: Rule-Based Exploration of Structured Data in the Browser
RuleML2015: Rule-Based Exploration of Structured Data in the Browser
 
RuleML2015: Compact representation of conditional probability for rule-based...
RuleML2015:  Compact representation of conditional probability for rule-based...RuleML2015:  Compact representation of conditional probability for rule-based...
RuleML2015: Compact representation of conditional probability for rule-based...
 
RuleML2015: Using Substitutive Itemset Mining Framework for Finding Synonymou...
RuleML2015: Using Substitutive Itemset Mining Framework for Finding Synonymou...RuleML2015: Using Substitutive Itemset Mining Framework for Finding Synonymou...
RuleML2015: Using Substitutive Itemset Mining Framework for Finding Synonymou...
 
RuleML2015: User Extensible System to Identify Problems in OWL Ontologies and...
RuleML2015: User Extensible System to Identify Problems in OWL Ontologies and...RuleML2015: User Extensible System to Identify Problems in OWL Ontologies and...
RuleML2015: User Extensible System to Identify Problems in OWL Ontologies and...
 
RuleML2015: Representing Flexible Role-Based Access Control Policies Using Ob...
RuleML2015: Representing Flexible Role-Based Access Control Policies Using Ob...RuleML2015: Representing Flexible Role-Based Access Control Policies Using Ob...
RuleML2015: Representing Flexible Role-Based Access Control Policies Using Ob...
 
RuleML2015: Rule Generalization Strategies in Incremental Learning of Disjunc...
RuleML2015: Rule Generalization Strategies in Incremental Learning of Disjunc...RuleML2015: Rule Generalization Strategies in Incremental Learning of Disjunc...
RuleML2015: Rule Generalization Strategies in Incremental Learning of Disjunc...
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes

  • 1. Introduction The API Structure and Functionality Conclusion and Future Work PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes Mohammad Sadnan Al Manir1 Alexandre Riazanov1 Harold Boley2 Christopher J.O. Baker1 1 Department of Computer Science and Applied Statistics University of New Brunswick, Saint John, Canada 2 Information and Communications Technologies National Research Council Canada The 6th International Symposium on Rules: Research Based and Industry Focused (RuleML-2012) Sadnan Al Manir PSOA RuleML API
  • 2. Introduction The API Structure and Functionality Conclusion and Future Work Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 3. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 4. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work PSOA RuleML An object-relational Web rule language Unlike F-logic and W3C RIF, PSOA RuleML defines Objects (frames) uniformly with relations Permits relation applications with Optional Object IDentifiers (OIDs) and Positional and Slotted arguments Allows positional-slotted object-applicative (psoa) terms and rules Sadnan Al Manir PSOA RuleML API
  • 5. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work PSOA Rules Exemplified Example (Rule-defined anonymous family frame) Group is used to collect a rule and two facts. Forall quantifier declares original universal argument variables and generated universal OID variables ?2, ?3, ?4. Infix :- separates conclusion from premises of rule, which derives anonymous/existential family frame from married relation And from kid relation of husb Or wife (the left-hand side is objectified on the right). Group ( Group ( Forall ?Hu ?Wi ?Ch ( Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 ( Exists ?1 ( family(husb->?Hu wife->?Wi child->?Ch) :- ?1#family(husb->?Hu wife->?Wi child->?Ch)) :- And(married(?Hu ?Wi) And(?2#married(?Hu ?Wi) Or(kid(?Hu ?Ch) kid(?Wi ?Ch))) ) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) ) married(Joe Sue) _1#married(Joe Sue) kid(Sue Pete) _2#kid(Sue Pete) ) ) Sadnan Al Manir PSOA RuleML API
  • 6. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work The API at a Glance Open-source at http://code.google.com/p/psoa-ruleml-api/ Allows factory-based Abstract Syntax Object (ASO) creation and manipulation Parses XML-based concrete PSOA RuleML syntax Translates ASOs into RIF-like Presentation Syntax (PS) Sadnan Al Manir PSOA RuleML API
  • 7. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 8. Introduction PSOA RuleML and the API The API Structure and Functionality Motivation Conclusion and Future Work Motivation Java API facilitates creating software using PSOA Enables PSOA adoption Creating Rule-based applications such as Rule authoring Rule engines To be used in a Clinical Intelligence project (HAIKU) Semantic modeling of Relational Databases Automatic generation of Semantic Web services Sadnan Al Manir PSOA RuleML API
  • 9. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 10. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering API Components Two main components Classes for creating and traversal of ASOs AbstractSyntax: Top level class containing interfaces for ASOs DefaultAbstractSyntax: Implements these interfaces Classes for parsing and rendering Validator: Validates input, calls rendering methods Parser: Parses PSOA/XML input using Java Architecture for XML Binding (JAXB) Sadnan Al Manir PSOA RuleML API
  • 11. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering The API Structure Figure: Main Components of the API Structure Sadnan Al Manir PSOA RuleML API
  • 12. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 13. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering How to Create a Factory? Code Snippet // Initialize Validator Validator v = new Validator(); // Initialize Parser Parser p = new Parser(); // PSOA/XML input file to be parsed File file = new File("family.psoa"); // Factory creation DefaultAbstractSyntax absSynFactory = new DefaultAbstractSyntax(); // Parsing of input document using JAXB AbstractSyntax.Document doc = p.parse(file, absSynFactory); Sadnan Al Manir PSOA RuleML API
  • 14. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Facts CreateX methods are used for ASO construction A fact is of type Atomic (e,g., Atom, Equal, Subclass) Example of an Atom _1#married(Joe Sue) - Joe and Sue are in a married relation with the OID _1 Creating Constants _1, married, Joe and Sue Const_Constshort const_1 = absSynFactory.createConst_Constshort("_1") Const_Constshort const_married = absSynFactory .createConst_Constshort("married") Const_Constshort const_Joe = absSynFactory .createConst_Constshort("Joe") Const_Constshort const_Sue = absSynFactory .createConst_Constshort("Sue") Sadnan Al Manir PSOA RuleML API
  • 15. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Facts (Cont’d) Adding positional terms const_Joe and const_Sue in a list of tuples LinkedList<AbstractSyntax.Term> tuplesList = new LinkedList<AbstractSyntax.Term>(); // iterate through all positional terms for (Object obj : tuple.getTERM()) { // check if the term is a variable if (obj instanceof Var) { tuplesList.addLast((Var) obj); } // check if the term is a constant else if (obj instanceof Const) { // as a refinement of Const, the tuplesList.addLast((Const) obj); // short constants const_Joe and } // const_Sue are added to tuplesList else if (obj instanceof Expr) { tuplesList.addLast((Expr) obj); } ... } Sadnan Al Manir PSOA RuleML API
  • 16. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Facts (Cont’d) Creating a list of tuples const_Joe and const_Sue Tuple tuples = absSynFactory.createTuple(tuplesList) Assembling _1, married and tuples into a psoaTerm // null indicates absence of slots Psoa psoaTerm = absSynFactory .createPsoa(const_1, const_married, tuples, null) Creating a fact of type Atom Atom atom = absSynFactory.createAtom(psoaTerm) CreateSubclass, CreateEqual methods are used for facts of type Subclass, Equality Sadnan Al Manir PSOA RuleML API
  • 17. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Rules A Rule contains Condition and Conclusion The Condition of the following Rule consists of A Conjunction of the atomic formula - ?2#married(?Hu ?Wi) and Disjunction of two atomic formulas - ?3#kid(?Hu ?Ch) and ?4#kid(?Wi ?Ch) Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 ( Exists ?1 ( ?1#family(husb->?Hu wife->?Wi child->?Ch)) :- And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) ) Sadnan Al Manir PSOA RuleML API
  • 18. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Rules (Cont’d) Creating Condition formula And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) Atom ?3#kid(?Hu ?Ch) as atomOr_1 Var var_3 = absSynFactory.createVar("3") ... Tuple tuples = absSynFactory.createTuple(tuplesList_1) Psoa psoaTerm_1 = absSynFactory .createPsoa(var_3, const_kid, tuples, null) Atom atomOr_1 = absSynFactory.createAtom(psoaTerm_1) Atom ?4#kid(?Wi ?Ch) as atomOr_2 Atom atomOr_2 = absSynFactory.createAtom(psoaTerm_2) Disjunction of two Atoms as a formulaOrList Formula_Or formula_Or = absSynFactory.createFormula_Or(formulaOrList) Sadnan Al Manir PSOA RuleML API
  • 19. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Rules (Cont’d) Creating Condition formula And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) Atom ?2#married(?Hu ?Wi) as atom_And Atom atom_And = absSynFactory.createAtom(psoaTerm_3) Conjunction of atom_And and formula_Or as a formulaAndList Formula_And formula_And = absSynFactory .createFormula_And(formulaAndList) Sadnan Al Manir PSOA RuleML API
  • 20. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Rules (Cont’d) Creating Conclusion formula Exists ?1 ( ?1#family(husb->?Hu wife->?Wi child->?Ch)) psoa term from variables, constants, 3 slots as a slotsList Var var_1 = absSynFactory.createVar("1") ... Slot slot_1 = absSynFactory.createSlot(const_husb, var_Hu) Slot slot_2 = absSynFactory.createSlot(const_wife, var_Wi Slot slot_3 = absSynFactory.createSlot(const_child, var_Ch) Psoa psoa = absSynFactory.createPsoa(var_1, const_family, null,slotsList) Conclusion with existentially quantified variable ?1 as a varsListExists Head rule_head = absSynFactory.createHead(varsListExists, atom_head) Sadnan Al Manir PSOA RuleML API
  • 21. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Construction of Rules (Cont’d) Creating Rule with the Condition and Conclusion formula Forall ?Hu ?Wi ?Ch ?2 ?3 ?4 ( Exists ?1 ( ?1#family(husb->?Hu wife->?Wi child->?Ch)) :- And(?2#married(?Hu ?Wi) Or(?3#kid(?Hu ?Ch) ?4#kid(?Wi ?Ch))) ) Implication from Condition and Conclusion Implies implication = absSynFactory.createImplies(rule_head,formula_And) Clause (Either an Implication or an Atomic formula) Clause clause = absSynFactory.createClause(implication) Rule with universally quantified variables as a varsListUniv Rule rule = absSynFactory.createRule(varsListUniv, clause) Sadnan Al Manir PSOA RuleML API
  • 22. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 23. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Traversal of ASOs Data structures representing PSOA expressions can be processed by simple recursive traversal All components of the structures can be accessed by the getX accessor methods General classes (see earlier Figure) are Sentence, Formula, Atomic, Term, Const, and Expr contain isX methods to recognize the specific instance types Specific classes of particular instances have to be identified by using instanceof Both ways are legitimate e.g., for an Atomic formula, an isX method in Atomic class needs to recognize if the instance is of type Atom, Subclass, or Equal object Sadnan Al Manir PSOA RuleML API
  • 24. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Traversal of ASOs (Cont’d) isEqual method in general class Atomic recognizes the instance of Equality Atom ?cost = "47.5"∧∧ xs:float immediately, makes a cast as the instance type Equal calls getLeft and getRight methods Traversing Equality Atom ?cost = "47.5"∧∧ xs:float assert this instanceof AbstractSyntax.Equal return (AbstractSyntax.Equal) this ... AbstractSyntax.Term getLeft() AbstractSyntax.Term getRight() The methods getLeft (?cost) and getRight ("47.5"∧∧ xs:float) refer to instances of other general class Term which uses isVar, isConstLiteral, isConstShort to recognize variables and constants Sadnan Al Manir PSOA RuleML API
  • 25. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Outline 1 Introduction PSOA RuleML and the API Motivation 2 The API Structure and Functionality Package Organization Construction of Abstract Syntax Objects Abstract Syntax Structure Traversal Parsing and Rendering 3 Conclusion and Future Work Sadnan Al Manir PSOA RuleML API
  • 26. Package Organization Introduction Construction of Abstract Syntax Objects The API Structure and Functionality Abstract Syntax Structure Traversal Conclusion and Future Work Parsing and Rendering Parsing and Rendering as Presentation Syntax Parsing: JAXB is used to generate the XML Parser which creates Java classes by binding a schema Rendering: PSOA/XML Fact transformed into PSOA/PS <Atom> <Member> <instance> <Const type="&psoa;iri">inst1</Const> </instance> <class> <Const type="&psoa;iri">family</Const> </class> </Member> inst1#family(Joe Sue Child->Pete) <tuple> <Const type="&psoa;iri">Joe</Const> <Const type="&psoa;iri">Sue</Const> </tuple> <slot> <Const type="&psoa;iri">Child</Const> <Const type="&psoa;iri">Pete</Const> </slot> </Atom> Sadnan Al Manir PSOA RuleML API
  • 27. Introduction The API Structure and Functionality Conclusion and Future Work Summary Inspired by the OWL API and Jena API The API is open-source and hosted in [1] Currently the API renders PSOA/XML only as PSOA/PS The reference translator PSOA2TPTP [2] is pursued in a companion effort Interoperates PSOA RuleML with TPTP Reasoners Sadnan Al Manir PSOA RuleML API
  • 28. Introduction The API Structure and Functionality Conclusion and Future Work Future Work Translation of ASOs back to PSOA/XML Merge the API with PSOA2TPTP Deploy for semantic modeling of Relational Databases in a Clinical Intelligence project Semantic mapping of Relational Databases to Ontologies Sadnan Al Manir PSOA RuleML API
  • 29. Introduction The API Structure and Functionality Conclusion and Future Work References [1] Al Manir, M.S., Riazanov, A., Boley, H. and Baker, C.J.O. PSOA RuleML API: A Tool for Processing Abstract and Concrete Syntaxes http://code.google.com/p/psoa-ruleml-api/. [2] Zou, G., Peter-Paul, R., Boley, H. and Riazanov, A. PSOA2TPTP: A Reference Translator for Interoperating PSOA RuleML with TPTP Reasoners. In RuleML-2012 proceedings Sadnan Al Manir PSOA RuleML API