RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

41
1/19 API4KP Metamodel API4KP Metamodel A Meta-API for Heterogeneous Knowledge Platforms T. Athan 1 R. Bell 2 E. Kendall 3 A. Paschke 4 D. Sottara 5 1 Athan Services (athant.com), West Lafayette, Indiana, USA 2 Raytheon, Fort Wayne, Indiana, USA 3 Thematix Partners LLC, New York, New York, USA 4 AG Corporate Semantic Web, Freie Universitaet Berlin, Germany 5 Department of Biomedical Informatics, Arizona State University, USA RuleML Symposium, Berlin, August 2015

Transcript of RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

Page 1: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

1/19

API4KP Metamodel

API4KP MetamodelA Meta-API for Heterogeneous Knowledge Platforms

T. Athan1 R. Bell2 E. Kendall3 A. Paschke4

D. Sottara5

1Athan Services (athant.com), West Lafayette, Indiana, USA

2Raytheon, Fort Wayne, Indiana, USA

3Thematix Partners LLC, New York, New York, USA

4AG Corporate Semantic Web, Freie Universitaet Berlin, Germany

5Department of Biomedical Informatics, Arizona State University, USA

RuleML Symposium, Berlin, August 2015

Page 2: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

2/19

API4KP Metamodel

Outline

1 Scope of the Standard

2 Scenario: The Connected Patient System

3 Foundations: Monads and OBDA Mappings

Page 3: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

3/19

API4KP Metamodel

Scope of the Standard

A Meta-API for Knowledge (Reasoning) Platforms (KPs)

A Meta-API is aplatform-independent model (PIM)for a family of APIs in specificlanguages, also called PSMs(platform-specific models).

API4KP provides aPIM for the externalAPIs of KPs.

Figure: A Monolithic KP Architecture.

Page 4: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

5/19

API4KP Metamodel

Scope of the Standard

Languages in Scope

Knowledge Representation and Reasoning Languages

Resource Description Framework (RDF)RDF Schema (RDFS)Web Ontology Language (OWL)Common Logic (CL)Event-Condition-Action RuleML (ECA). . .

Data Representation Languages

Extensible Messaging and Presence Protocol (XMPP)JSON. . .

Page 5: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

6/19

API4KP Metamodel

Scenario: The Connected Patient System

The Connected Patient System 0: Overview

Figure: A Distributed KP Architecture for Stream Processing, ClinicalDecision Support (CDS) and Case History Storage.

Page 6: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

7/19

API4KP Metamodel

Scenario: The Connected Patient System

The Connected Patient System I: Streaming Data andQuery Results

Biomedical devices are available via pub-sub.Streamed data arrive in multiple formats e.g. XMPP, RDFVocabularies are defined in RDFS, OWL, Common Logic (CL).Healthcare providers submit SPARQL queries throughAPI4KP, receiving streamed incremental results, updated asnew data arrive.

Figure: A Heterogeneous Stream Processing KP Architecture.

Page 7: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

8/19

API4KP Metamodel

Scenario: The Connected Patient System

The Connected Patient System II: CDS

A Clinical Decision Support System (CDS) is defined usingevent-condition-action (ECA) rules submited throughAPI4KP, reacting to

simple events (e.g. a vital parameter exceeding a threshold)complex events (e.g. a decreasing trend in the average dailyphysical activity)

intervening with alerts and reminders.A failure of response (through API4KP) to an alert leads toescalation to another recipient.

Figure: A Clinical Decision Support (CDS) KP Architecture.

Page 8: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

9/19

API4KP Metamodel

Scenario: The Connected Patient System

The Connected Patient System III: Case History

The system maintains a stateful representation for patientsqualifying for clinical pathways.Clinicians check for compliance with planned orders.As medical guidelines evolve, the logic of the pathway mayneed revision: queries to the patient’s history should becontextualized to whatever logic was valid at the time orderswere placed.

Figure: A Case History KP Architecture.

Page 9: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

10/19

API4KP Metamodel

Scenario: The Connected Patient System

The Connected Patient System: Complete

Figure: A Distributed KP Architecture.

Page 10: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

A metamodel is a model about models.Entities in the universe of a KP fall principally into these classes:

Knowledge Sources - Models of the World

Knowledge Environments - Models of Relationships

Knowledge Operations - the Meta-API, Models of APIs

Knowledge Events

Page 11: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources : source of machine-readableinformation with semantics.

Knowledge Environments

Knowledge Operations

Knowledge Events

Page 12: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Mutable or Immutable (a.k.a Knowledge Resources)By level of abstraction (Knowledge Source Level)Basic or Structured

Knowledge Environments

Knowledge Operations

Knowledge Events

Page 13: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Knowledge T Environments : mathematical structure ofmappings, where the domain and codomains of the mappings,called members of the knowledge environment, are instancesof class T.

Knowledge Operations

Knowledge Events

Page 14: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Knowledge Environments

Knowledge Operations : functionality (possibly withside-effects. i.e. effects beyond the output value returned)having a knowledge source, environment or operation type inits signature.

Knowledge Events

Page 15: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Knowledge Environments

Knowledge Operations

Knowledge Events : successful evaluation or execution of aknowledge operation by a particular application at a particulartime

Page 16: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources, e.g. the database of the Case History KP.

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

Page 17: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources, e.g.the OWL ontology in the Stream Processing KP.

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

Page 18: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,e.g. the ECA rulebase in the CDS KP.

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

Page 19: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources, e.g.the input and output streams of the Stream Processing KP.

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

Page 20: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources, e.g.the effects generated by the CDS KP.

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

Page 21: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources, e.g. afailed communication from the CDS KP.

Descriptions of state transitions for stateful KnowledgeSources,

Page 22: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources, e.g. ECA simulations for protocol development.

Page 23: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

12/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Structures Needed in API4KP

The various knowledge representations in the scenario require avariety of structures.

Descriptions of I/O programs for persistent KnowledgeSources,

Unordered collections for declarative Knowledge Sources,

Ordered collections for order-prioritized Knowledge Sources,

Concurrent sequences for streamed Knowledge Sources,

Descriptions of side-effects for active Knowledge Sources,

Failure-aware types for reliable Knowledge Sources,

Descriptions of state transitions for stateful KnowledgeSources,

In functional programming, monads have been created for each ofthese cases, providing a concept of equivalence that is isolatedfrom side-effects and non-determinism, which is critical forconceptual modeling.

Page 24: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

Satisfies the ”Monad Laws”

has a ”unit” method to generate a simple instance of M[A]from some Ahas a ”join” method to flatten an instance of M[M[A]] to M[A]e.g. List[int].join( 〈 〈1,2〉, 〈3,4〉 〉 ) = 〈1,2,3,4〉

Page 25: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

14/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

Well-Known Monads

Persistence: IO

Unordered without Multiplicity: Set

Ordered with Multiplicity: List

Concurrency: Future, Observable

Side-effects: Task

Failure: Maybe/Option/Try/Either

State Transitions: State

...

Page 26: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

15/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

NestedM: a monad based on the free M monad

The simplest example of a structure for knowledge resources is setsof sets. There is a set monad, Set[A]: a set whose members are oftype A.

NestedSet[B] = Set[B + NestedSet[B]]

where B would be the type for Basic Knowledge Resource and +repsresents disjoint union, a.k.a. coproduct. But Set is just oneparticular kind of monad. For any monad M, we may defineanother monad NestedM:

NestedM[B] = M[B + NestedM[B]]

NestedM is related to the free monad of M through the equivalence

FreeM[B] ≡ B + NestedM[B]

Page 27: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

16/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

API4KP Structured Knowledge Resources

The structure of API4KP Structured Knowledge Resources can beany NestedM monad that is compatible with the semantics of itscontent.Details are available in the API4KP repositoryhttps://github.com/API4KBs/api4kbs/blob/currying/Monad_Trees.pdf

Page 28: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

17/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

General Data Formats Included in HeterogeneousLanguage Environments

Knowledge Resources in API4KP include resources in formatswithout inherent semantics, such as XML, JSON or SQL, wherethe semantics is provided by mapping into knowledgerepresentation and reasoning (KRR) language.

The monadic character of structured knowledge resourcesallows environment mappings to be applied within thestructure.

To apply semantics, it is sufficient that the focus of aheterogeneous language environment be a KRR language.

Further, mappings from KRR languages to data formats areuseful in persistence, e.g. in a database.

Page 29: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

18/19

API4KP Metamodel

Summary

Summary

The Connected Patient System scenario encompasses anumber of architectural paradigms that should be addressedby API4KP.

A monadic nesting structure has been created forcompatibility with the diversity of semantic aspects illustratedin the scenario, including order, state, concurrency,side-effects, serialization and I/O.

An extended concept of heterogeneous environment isemployed in order to cover mapping between domain-specificdata formats and knowledge representation languages.

OutlookAn initial submission of API4KP to OMG is anticipated inNovember 2015.Development of the metamodel will continue, with thespecification of operations making explicit use of monads.

Page 30: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

19/19

API4KP Metamodel

Summary

Thanks to

Roger Burkhart

James Odell

Ed Skoviak

Ralph Schafermeier

Bobbin Teegarden

Evan Wallace

The DOL Committee

...

Page 31: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Mutable or Immutable (a.k.a Knowledge Resources)By level of abstraction (Knowledge Source Level)

Item - physical source, e.g. on hard disk or in memoryManifestation - concrete syntax, e.g. OWL axiom inManchester syntaxExpression - abstract syntax, e.g. OWL axiomAsset - equivalence class of Knowledge Expressions, with someequivalence relation e.g. logical equivalence

Basic or Structured

Knowledge Environments

Knowledge Operations

Knowledge Events

Page 32: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Knowledge T Environments

Member type T: Language, Format, ...FocusedPreserving

Knowledge Operations

Knowledge Events

Page 33: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

11/19

API4KP Metamodel

Scenario: The Connected Patient System

API4KP Metamodel: Classes

Entities in the universe of a KP fall principally into these classes:

Knowledge Sources

Knowledge Environments

Knowledge OperationsActions (unary)

Lifting, Lowering, Horizontal, Higher-Order, VoidIdempotentPreserving

Knowledge Events

Page 34: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

Page 35: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A] , e.g. thetype of lists with a generic parameter, List[A]

Page 36: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

List is a monadList[int] is a monadic type〈1,2,3〉 is an instance of type List[int]

Page 37: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

has a map method allowing a function to be applied to eachelement of the list while preserving composition

Page 38: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

has a map method allowing a function to be applied to eachelement of the list while preserving compositionList[int].map( 〈1,2,3〉, s → 2*s) = 〈2, 4, 6〉List[int].map( 〈2,4,6〉, s → 〈s,2*s〉) = 〈 〈2,4〉, 〈4,8〉, 〈6,12〉 〉Exercise for the Reader: showList[int].map( List[int].map( x, f), g) =List[int].map( x, f o g )

Page 39: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

Satisfies the ”Monad Laws”

has a ”unit” method to generate a simple instance of M[A]from some A

Page 40: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

Satisfies the ”Monad Laws”

has a ”unit” method to generate a simple instance of M[A]from some A e.g. List[int].unit(3) = 〈3〉

Page 41: RuleML2015: API4KP Metamodel: A Meta-API for Heterogeneous Knowledge Platforms

13/19

API4KP Metamodel

Foundations: Monads and OBDA Mappings

What is a Monad (in Functional Programming?

Endofunctor on the category of types, A → M[A]

Satisfies the ”Monad Laws”

has a ”unit” method to generate a simple instance of M[A]from some Ahas a ”join” method to flatten an instance of M[M[A]] to M[A]