Grailog

From RuleML Wiki
Jump to: navigation, search

The Graph inscribed logic (Grailog) is a systematic combination of generalized graph constructs for visual data & knowledge representation ranging from (binary and n-ary) relational logic to Horn logic, description logic, object/frame logic, higher-order logic, and modal logic. Grailog thus provides a framework enabling analytics via 2-dimensional graph-logic visualization for humans in the loop of data & knowledge elicitation, specification, validation, as well as reasoning. Such Grailog visualization also serves as a teaching vehicle for making central (description- and Horn-)logical notions of ontologies and rules accessible to students of AI, Semantic Technologies, and related areas, as initiated for Logical Foundations of Cognitive Science. The Grailog Initiative for data & knowledge visualization is aligned with the Web-rule industry standard RuleML, where co-development is giving rise to synergies.

A RuleML 2013 paper introduces Grailog 1.0: Graph-Logic Visualization of Ontologies and Rules (slides). If you (a professional/student researcher or developer) have some feedback and/or are interested in the Initiative, e.g. in advancing the Grailog systematics, tools (translators, editors, ...), or use cases, please contact Harold Boley. Grailog is based on Directed Recursive Labelnode Hypergraphs (DRLHs), extended for the uniform visualization of the mentioned logics. A joint effort with Borislav Iordanov is currently exploring Grailog support in HyperGraphDB.

1 News

  • The PSOA RuleML/Grailog use case focusing on geospatial knowledge was presented at AWOSS-2014 as part of "A Translator Framework for the Interoperation of Graph plus Relational Data and Rules" (InteropGraphRel)
  • The Grailog Initiative has appeared in social media starting with a visualization generated by Grailog KS Viz for the Datalog rule likes(mary,?X) :- treats(?X,mary,dinner,downtown), prefers(?X,wine,beer).

2 Specification Development

Grailog, as a uniform generalized-graph rendering of data & knowledge logics, is focused on a 2D (graphical) syntax. In the following specification, this visualization syntax is mapped to a 1D (symbolic) presentation syntax, bridging to current informal understanding and formal semantics. But Grailog is open towards any other presentation syntax, and further mappings can be defined to access such alternate syntaxes. In the specification, the visualization syntax is also mapped to RuleML/XML serialization syntax, which captures parse trees in a linearized format. Continuing the tradition of abstract syntax, the formal semantics could also be associated with these. Ultimately, however, the formal semantics could be directly associated with the visualization syntax.

The newest edition of Grailog is specified in presentable form here (Version 1.0, Editorial Update 11 November 2013):

While the current-specification deck RuleMLGrailog.pdf includes the hidden slides of RuleMLGrailog.ppt, conference-talk uploads ISO15926AndSemanticWebTechnologiesNetwork/Boley2013.pdf etc. show subsets of non-hidden slides.

3 Initial Implementations

Two Grailog visualizers (symbolic-to-visual generators) for different Grailog sublanguages are available online:

Future Grailog serializers (visual-to-symbolic parsers) will be more involved. The above Specification Development comes with a mapping from (2-dimensional, visual) generalized graphs to a POSL-type (1-dimensional, symbolic) logic. The transition from RuleML/Grailog to RuleML/POSL to RuleML/XML proceeds in the direction from human-oriented to machine-oriented syntaxes. Since a translator from RuleML/POSL to RuleML/XML already exists (see POSL), its three components (i.e., its source RuleML/POSL, its target RuleML/XML, and the translator itself) could be generalized towards full RuleML/Grailog expressiveness, and a translator from RuleML/Grailog to RuleML/XML could then be obtained by implementing a translator from RuleML/Grailog (in an appropriate format) to the generalized RuleML/POSL. Alternatively, a translator from RuleML/Grailog (maybe in SVG/XML) directly to the generalized RuleML/XML could be implemented. Subsets of Grailog corresponding to Datalog and Hornlog RuleML will again be natural starting points for such an open source serializer project.

Grailog visualizers such as Grailog KS Viz and serializers could be tested by round-tripping, e.g. trying to reconstruct the Datalog RuleML/XML input to Grailog KS Viz from its SVG/XML output.

4 Sample Visualizations

4.1 Latin Example

Consider a 'Latin-learning' example for relational knowledge, e.g. in the relational part of Positional-Slotted, Object-Applicative (PSOA) RuleML, consisting of 3-ary relationships, Show(John Latin Kate) and Teach(Mary Latin Paul). The following figures contrast its straightforward visualization as directed 3-ary hyperarcs in Grailog with their reduction to arcs in the Directed Labeled Graph (DLG) subset. These two versions are expanded to a larger series in the RuleMLGrailog slides and in Section 2 of the Grailog 1.0 paper.

Hyperarcs for showing/teaching relationships crossing in degree-central Latin node
Distinction of showing/teaching relationships is harder with DLG arcs


4.2 Family Example

The following 'modern-family' example for the generalized object/frame logic of PSOA RuleML in Grailog shows two facts (given data) and a rule (knowledge) on the left, deriving another fact (new data) on the right. The wavy boundary line around the two kid premises visualizes the Or. The examples are further explained in Section 8 of the Grailog 1.0 paper. An implementation using the symbolic RIF-like PSOA presentation syntax is available at PSOA RuleML.

Psoa family example with given relationships for rule premises
Ground facts (rule-derived: frame) modeling family semantics


5 Test Suites

The Loan Processor Suite for testing and learning Grailog, RuleML, etc. involves transforming, visualizing, and querying Datalog RuleML decision rules. It is described in LoanProcessor-talk.pdf (LoanProcessor-talk.pptx) and was implemented

  1. starting with the inline-documented Prolog-like RuleML/POSL document LoanProcessor.txt,
  2. transforming it to the RuleML/XML document LoanProcessor.xml (View Page Source) using the OO jDREW 1.0 POSL/RuleML Translator (Java Web Start) as well as (a) a prelude referring to GrailogKSViz_monospace.xslt, (b) the root element <RuleML>, and (c) <Assert> instead of <Rulebase>,
  3. visualizing it (well with Internet Explorer and okay with Firefox) as the RuleML/Grailog/SVG/XML document LoanProcessor.svg (View Page Source) that contains JavaScript using the above-explained Grailog KS Viz, and
  4. querying its Typed POSL version LoanProcessor.posl with the OO jDREW 1.0 snapshot (Java Web Start).

The visual feedback through earlier versions of LoanProcessor.svg has helped improving the presentation source LoanProcessor.txt (described in LoanProcessor-talk.pdf) when preparing a training session for Decision (boot) CAMP 2013. This shows that there are situations where Grailog Visualization Syntax can help with human-in-the-loop knowledge validation more than can RuleML Presentation Syntax alone.

Local Tests: For testing Grailog KS Viz on local machines, the RuleML/XML document LoanProcessorLocal.xml (Save Link As) can be downloaded as LoanProcessorLocal.xml, whose prelude refers to a sibling document GrailogKSViz_monospace.xslt, which can be downloaded from GrailogKSViz_monospace.xslt (Save File).

The Loan Processor Suite can be extended with Datalog RuleML/XML validation using RNC or XSD as well as with further transformations using the RuleML compactifier ROC (thus preparing Grailog KS Viz transformation) and the normalizer RON. Some or all of the predicates' positional arguments (especially, ?RiskLevel and ?RatiMin) could be replaced by slots, whose names would make the meanings of positions explicit as in the above visualizations of the PSOA RuleML/Grailog Family Example.

6 Use Cases

Various use cases for Grailog were done; others are ongoing or planned. The following is a selection. Please send your candidate use cases to Harold Boley.

  • Use cases for DLGs, utilized as simple semantic nets, i.e. of atomic ground formulas in function-free dyadic predicate logic, also constitute use cases for DRLHs and Grailog; e.g.: binary Datalog ground facts, RDF triples, Facebook's Open Graph, and Google's Knowledge Graph
  • Other special use cases for Grailog such as for Directed Hypergraphs are currently being explored in connection with HyperGraphDB.
  • The visualizations for the course Logical Foundations of Cognitive Science were done with earlier versions of Grailog; going beyond a use case, this was a preliminary Grailog case study involving interdisciplinary students, who were greatly motivated by such visualizations which supported their comprehension of logic
  • Earlier DRLH use cases, e.g. for parts lists in mechanical engineering will be revised as Grailog use cases
  • User-profile knowledge-base validation for the Social Semantic Web system Rule Responder with instantiations such as WellnessRules (Datalog) and WellnessRules2 (Horn logic) will benefit from Grailog visualization, especially for end users who are not familiar with RuleML Presentation Syntax
  • The above Grailog sample visualizations of relational and object-centered representations in PSOA RuleML have been adapted for a PSOA RuleML/Grailog use case focusing on geospatial knowledge, initially for facts, also permitting integrated object-relational knowledge (InteropGraphRel)
  • Grailog data and knowledge visualizations for Ontology/Rule-Based Data Access (OBDA/RBDA) can help domain experts, e.g. with query rules (including integrity rules), knowledge-base rules (for query rewriting and database materialization), as well as mapping rules (for query unfolding and database folding)
  • A use case on Grailog for Learning Object (LO) visualization is in preparation

7 Feature Summary

Grailog graphs basically consist of atomic and complex nodes, depicted as boxes, and of directed n-ary hyperarcs (for n=2: arcs) connecting n nodes, depicted as arrows. A complex box can be seen as 2-dimensionally 'bracketed' recursive Grailog graph. An arrow with n>2 can be regarded as uniquely 'colored' directed path of arcs.

For a systematics that orthogonally combines Grailog box corners and box shapes see Fig. 9 of the Grailog 1.0 paper, whose shape descriptions from Rect2cave to Round4vex are updated in the following table. The columns distinguish per copy (Rect), instantiation (Snip), and value (Round) evaluation as corner types. The rows distinguish neutral (angle), functional (2cave, 4cave), and relational (2vex, 4vex) operation as shape types.

Systematics of corners and shapes


The following table sequentially groups key features of Grailog (including box corners and shapes), with rows providing mnemonics for their visual forms as well as giving symbolic forms where applicable. For specification development see the RuleMLGrailog slides.

Mnemonics Visual Symbolic
Boolean (lines)
Conjunction "unwavering" about all conjuncts being true linear line (box) And: '∧'
Disjunction "wavering" about which disjunct being true wavy line (box) Or: '∨'
Negation "minus sign" to complement truth value dashed line (box, arrow) Not: '¬'
Evaluation (box corners)
Quote/Copy "unevaluated" box contents rect-pointed corners
Reify/Instantiate "partially evaluated" box contents snipped corners
Value "fully evaluated" box contents rounded corners
Operation (box shape)
Neutral "intermediate" between concave and convex box shapes straight top/bottom and left/right boundary line
Functional "skateboard-halfpipe" box shape concave top/bottom (2cave) and possibly left/right (4cave) boundary line
Function Application "less (2) concave" since function used concave top/bottom (2cave) boundary line
Function "more (4) concave" since function itself concave top/bottom and left/right (4cave) boundary line
Relational "database-barrel" box shape convex top/bottom (2vex) and possibly left/right (4vex) boundary line
Relation Application "less (2) convex" since relation used convex top/bottom (2vex) boundary line
Relation "more (4) convex" since relation itself convex top/bottom and left/right (4vex) boundary line
OID-Instance Connection (link style)
FromOID "attaching" instance-headed arrow to Object IDentifier bullet-tailed single-line (slot or shelf) arrow
Operator-Instance Connection (link style)
Apply "applying" operator to ordered instances light single-line arrow cutting intermediate boxes application of n-ary operator (function or relation) to n argument instances
HasInstance "populating" relational operator (class) with instance light single-line arrow typing / unary-relation application (special Apply)
Instance-Instance Connection (link style)
SameIndividual Peirce’s line of identity light single-line link (Instance) Equal: '='
OrientedIndividual "colonized" tail of single-line link defined by its head colon-tailed light single-line link (Instance) Assignment: ':='
Class-Class Connection (link style)
Subclassing "ordering" subclass under superclass heavy single-line arrow SubClassOf
Equiclassing "aligning" class with class heavy single-line link EquivalentClasses
Formula-Formula Connection (link style)
Implication "stretched" logical '⇒' symbol double-line arrow Implies: '⇒'
Equivalence "stretched" logical '⇔' symbol double-line double-headed arrow Equivalent: '⇔'
Term-Term Connection (link style)
Equality "stretched" mathematical '=' symbol double-line link (Term) Equal: '='
OrientedEquality "colonized" tail of double-line link defined by its head colon-tailed double-line link (Instance) Assignment: ':='

8 BibTeX References

@misc{Boley11f,

   Author = {Harold Boley},
   Title = "{RuleML/Grailog: The Rule Metalogic Visualized with Generalized Graphs}",
   Howpublished = "{PhiloWeb 2011: The Second International Symposium on the Web and Philosophy, Thessaloniki, Greece}",
   month = oct,
   year = {2011},
   URL = "http://www.cs.unb.ca/~boley/talks/RuleMLGrailog.pdf"

}

@InProceedings{Boley13,

 title =  "{Grailog 1.0: Graph-Logic Visualization of Ontologies and Rules}",
 author =  "Harold Boley",
 booktitle =  "Proc. 7th International Web Rule Symposium: Research Based and Industry Focused (RuleML 2013), Seattle, Washington, USA",
 publisher =  "Springer",
 month = jul,
 year =   "2013",
 volume =  "8035",
 pages =  "52--67",
 series =  "Lecture Notes in Computer Science"

}

@InProceedings{KochSchmidt+13,

 title =  "{Grailog KS Viz: A Grailog Visualizer for Datalog RuleML Using an XSLT Translator to SVG}",
 author =  "Martin Koch and Sven Schmidt and Harold Boley and Rainer Herpers",
 month = jul,
 year =   "2013",
 booktitle =  "{Proceedings of the RuleML 2013 Challenge, at the 7th International Web Rule Symposium}",
 publisher =  "CEUR",
 editor =  "Paul Fodor and Dumitru Roman"

}

@InProceedings{AkbariYan+13,

 title =  "{Visualizing SWRL Rules: From Unary/Binary Datalog and PSOA RuleML to Graphviz and Grailog}",
 author =  "Ismail Akbari and Bo Yan and Junyan Zhang and Harold Boley",
 booktitle =  "Proc. 4th Canadian Semantic Web Symposium, Montreal, Qc, Canada",
 month = jul,
 year =   "2013"

}