Doctoral Consortium@RuleML2015: Seamless Cooperation of JAVA and PROLOG for Rule-Based Software...

Post on 18-Aug-2015

76 views 3 download

Tags:

transcript

Seamless Cooperationof Java and Prolog

for Rule-Based Software Development

Ludwig Ostermayer

University of Wurzburg, Department of Computer Science,Efficient Algorithms and Knowledge-Based Systems

04.08.2015

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Agenda

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Modern Software Systems

Modern Software Systems often consist of dynamically linked Subsystems.

Subsystems

modular

solve problems of a certain problem domain

evolve continually and often independently

are implemented with different programming/scripting languages

follow different programming paradigms

Pfeil mit Text Interoperability Problems

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Modern Software Systems

Modern Software Systems often consist of dynamically linked Subsystems.

Subsystems

modular

solve problems of a certain problem domain

evolve continually and often independently

are implemented with different programming/scripting languages

follow different programming paradigms

Pfeil mit Text Interoperability Problems

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Modern Software Systems

Modern Software Systems often consist of dynamically linked Subsystems.

Subsystems

modular

solve problems of a certain problem domain

evolve continually and often independently

are implemented with different programming/scripting languages

follow different programming paradigms

Pfeil mit Text Interoperability Problems

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Modern Software Systems

Modern Software Systems often consist of dynamically linked Subsystems.

Subsystems

modular

solve problems of a certain problem domain

evolve continually and often independently

are implemented with different programming/scripting languages

follow different programming paradigms

Pfeil mit Text Interoperability Problems

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Modern Software Systems

Modern Software Systems often consist of dynamically linked Subsystems.

Subsystems

modular

solve problems of a certain problem domain

evolve continually and often independently

are implemented with different programming/scripting languages

follow different programming paradigms

Pfeil mit Text Interoperability Problems

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Object-Oriented Programming

Java

very popular OO language

rich set of libraries and tools

mature integrated development environments

active community

Flaws

verbose and little declarative

no native rule representation

no API for rule-based development

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Logic Programming

Prolog

rule-based logic programming language

expert systems, linguistics and artificial intelligence

backtracking, partial bindings and incomplete structures

concise and declarative programs

Flaws

different Prolog implementations (BProlog, Ciao, ..., YAP)

platform dependence

programming in the large

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Cooperation of Java and Prolog

Reaping the benefits of decades of LP research whilesaving the investment already done for Java!1

1M. Calejo, PACLP, 1999.

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Cooperation of Java and Prolog

Reaping the benefits of decades of LP research whilesaving the investment already done for Java!1

1M. Calejo, PACLP, 1999.

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Isn’t it already sufficiently solved?

Related Work

Prolog Cafe (M. Banbara et al., 1997)

Jpl (P. Singleton et al., 1999)

InterProlog ( M. Calejo, 1999)

based on Linguistic Symbiosis (M. D’Hondt, 2004)

based on Annotations and Generics (M. Cimadamore et al., 2007)

Logic Java (T. Majchrzak et al., 2011)

Logic Objects ( S. Castro et al., 2013)

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Isn’t it already sufficiently solved?

Related Work

Prolog Cafe (M. Banbara et al., 1997)

Jpl (P. Singleton et al., 1999)

InterProlog ( M. Calejo, 1999)

based on Linguistic Symbiosis (M. D’Hondt, 2004)

based on Annotations and Generics (M. Cimadamore et al., 2007)

Logic Java (T. Majchrzak et al., 2011)

Logic Objects ( S. Castro et al., 2013)

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Observations

Java evolves ... new approaches to cooperate with Prologemerge!

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Observations

Java evolves ... new approaches to cooperate with Prologemerge!

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Synthesis of the State of the Art

Continuous Problems

portability

dependence on a specific Prolog implementationdependence on native codemodifications to the Jvm

obfuscation

boilerplate codecomplex blended syntax

overhead

coding praxisperformance

IDE support

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Connector Architecture for Prolog and Java

Java

Classes

Annotations

Objects

Prolog

Rules

Facts

PVNGenerator

OTM UnificationTerm

Capja

concise, extensible and intuitive communication layer purelyimplemented in Java

customizable object-term mapping (otm)

pluggable Prolog interface system (default interface included)

not limited to a certain Prolog system

high communication performance during runtime

smooth development cycle with IDE support in Java

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Object-Term Mapping (otm)

default mapping

Annotation layer in Java for a customized mapping

Prolog-View on a given class in Java (@PlView Annotation)

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Object-Term Mapping (otm)

default mapping

Annotation layer in Java for a customized mapping

Prolog-View on a given class in Java (@PlView Annotation)

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Object-Term Mapping (otm)

default mapping

Annotation layer in Java for a customized mapping

Prolog-View on a given class in Java (@PlView Annotation)

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Prolog-View Notation (PVN)

Prolog list-based notation

for the integration of Prolog predicates in Java

describes the structure of a term...

enriched by mapping information for Java

sufficient to generate from it the skeleton of a class...

... or an @PlView Annotation to control the otm from Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Prolog-View Notation (PVN)

Prolog list-based notation

for the integration of Prolog predicates in Java

describes the structure of a term...

enriched by mapping information for Java

sufficient to generate from it the skeleton of a class...

... or an @PlView Annotation to control the otm from Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Prolog-View Notation (PVN)

Prolog list-based notation

for the integration of Prolog predicates in Java

describes the structure of a term...

enriched by mapping information for Java

sufficient to generate from it the skeleton of a class...

... or an @PlView Annotation to control the otm from Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Prolog-View Notation (PVN)

Prolog list-based notation

for the integration of Prolog predicates in Java

describes the structure of a term...

enriched by mapping information for Java

sufficient to generate from it the skeleton of a class...

... or an @PlView Annotation to control the otm from Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Prolog-View Notation (PVN)

Prolog list-based notation

for the integration of Prolog predicates in Java

describes the structure of a term...

enriched by mapping information for Java

sufficient to generate from it the skeleton of a class...

... or an @PlView Annotation to control the otm from Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Pluggable Interface System

(default) Portable Prolog Interface (PPI)

PPI successfully tested with B-, Ciao-, Gnu-, Swi-, Tu-, Xsb-and Yap-Prolog.

works with existing interfaces like Jpl, InterProlog

works with Prolog sockets or servers

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Pluggable Interface System

(default) Portable Prolog Interface (PPI)

PPI successfully tested with B-, Ciao-, Gnu-, Swi-, Tu-, Xsb-and Yap-Prolog.

works with existing interfaces like Jpl, InterProlog

works with Prolog sockets or servers

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Pluggable Interface System

(default) Portable Prolog Interface (PPI)

PPI successfully tested with B-, Ciao-, Gnu-, Swi-, Tu-, Xsb-and Yap-Prolog.

works with existing interfaces like Jpl, InterProlog

works with Prolog sockets or servers

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Pluggable Interface System

(default) Portable Prolog Interface (PPI)

PPI successfully tested with B-, Ciao-, Gnu-, Swi-, Tu-, Xsb-and Yap-Prolog.

works with existing interfaces like Jpl, InterProlog

works with Prolog sockets or servers

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

Pluggable Interface System

(default) Portable Prolog Interface (PPI)

PPI successfully tested with B-, Ciao-, Gnu-, Swi-, Tu-, Xsb-and Yap-Prolog.

works with existing interfaces like Jpl, InterProlog

works with Prolog sockets or servers

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Components of Capja

JPLambda

concise and readable Prolog queries in Java

based on Java Lambda expressions

code as data

Lambda expression to further narrow the result set

the Lambda’s evaluation is transferred (where possible) to Prolog

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Limitations

What Capja (currently) can’t do for you...

support for queries from Prolog to Java (upcoming)

concurrency management

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Limitations

What Capja (currently) can’t do for you...

support for queries from Prolog to Java (upcoming)

concurrency management

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Limitations

What Capja (currently) can’t do for you...

support for queries from Prolog to Java (upcoming)

concurrency management

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Experiments

Case Studies

knowledge bases (e-commerce)

graphs (metro systems)

planning (logistics)

Results

simple and clean code

up to 50% less lines of code (loc) as with pure Java

up to 25% less loc compared to an implementation with Jpl

better or (at least) comparable performance compared to formerapproaches

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Thanks for the Attention!

Questions are welcome!

ludwig.ostermayer@uni-wuerzburg.de

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Talk is cheap. Show me the Code.2

A Person class with two different Prolog-Views...

1 @PlView(viewId="V1", dropArgs={"familyName"},2 modifyArgs={@PlArg(valueOf="children",viewId="V2")})3 @PlView(viewId="V2", functor="child",4 orderArgs={"firstName"})5 class Person {6 private String firstName;7 private String familyName;8 private int age;9 private ArrayList<Person> children;

10 //...constructors and methods...11 }

... and its corresponding PVN representation.

1 pl_view(person, compound, [pl_arg(firstName, string),2 pl_arg(familyName, string), pl_arg(age, int),3 pl_arg(children, arrayList, person)]).

2Linus Torvald

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Talk is cheap. Show me the Code.2

A Person class with two different Prolog-Views...

1 @PlView(viewId="V1", dropArgs={"familyName"},2 modifyArgs={@PlArg(valueOf="children",viewId="V2")})3 @PlView(viewId="V2", functor="child",4 orderArgs={"firstName"})5 class Person {6 private String firstName;7 private String familyName;8 private int age;9 private ArrayList<Person> children;

10 //...constructors and methods...11 }

... and its corresponding PVN representation.

1 pl_view(person, compound, [pl_arg(firstName, string),2 pl_arg(familyName, string), pl_arg(age, int),3 pl_arg(children, arrayList, person)]).

2Linus Torvald

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Talk is cheap. Show me the Code.2

A Person class with two different Prolog-Views...

1 @PlView(viewId="V1", dropArgs={"familyName"},2 modifyArgs={@PlArg(valueOf="children",viewId="V2")})3 @PlView(viewId="V2", functor="child",4 orderArgs={"firstName"})5 class Person {6 private String firstName;7 private String familyName;8 private int age;9 private ArrayList<Person> children;

10 //...constructors and methods...11 }

... and its corresponding PVN representation.

1 pl_view(person, compound, [pl_arg(firstName, string),2 pl_arg(familyName, string), pl_arg(age, int),3 pl_arg(children, arrayList, person)]).

2Linus Torvald

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Talk is cheap. Show me the Code.2

A Person class with two different Prolog-Views...

1 @PlView(viewId="V1", dropArgs={"familyName"},2 modifyArgs={@PlArg(valueOf="children",viewId="V2")})3 @PlView(viewId="V2", functor="child",4 orderArgs={"firstName"})5 class Person {6 private String firstName;7 private String familyName;8 private int age;9 private ArrayList<Person> children;

10 //...constructors and methods...11 }

... and its corresponding PVN representation.

1 pl_view(person, compound, [pl_arg(firstName, string),2 pl_arg(familyName, string), pl_arg(age, int),3 pl_arg(children, arrayList, person)]).

2Linus Torvald

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Talk is cheap. Show me the Code.2

A Person class with two different Prolog-Views...

1 @PlView(viewId="V1", dropArgs={"familyName"},2 modifyArgs={@PlArg(valueOf="children",viewId="V2")})3 @PlView(viewId="V2", functor="child",4 orderArgs={"firstName"})5 class Person {6 private String firstName;7 private String familyName;8 private int age;9 private ArrayList<Person> children;

10 //...constructors and methods...11 }

... and its corresponding PVN representation.

1 pl_view(person, compound, [pl_arg(firstName, string),2 pl_arg(familyName, string), pl_arg(age, int),3 pl_arg(children, arrayList, person)]).

2Linus Torvald

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015

Some objects...

1 Person homer = new Person("Homer", null, 40);2 Person bart = new Person("Bart", "Stimpson", 10);3 homer.getChildren().add(bart);

...that we map via the otm to terms...

1 % default mapping of homer2 person('Homer', X, 40, [person('Bart',10,[])]).3 % the Prolog-View "V1" of homer4 person('Homer', 40, [child('Bart')]).

... and that can be queried using a JPLambda.

1 Unifier<Person> personUnifier = new Unifier$3141<>(2 person -> person.getFamilyName() == "Stimpson"3 && person.getAge() < 18);4 //person(FirstName, 'Stimpson', Age, Children), Age < 185 Iterator<Person> personIt1 = personUnifier.unify();6 Iterator<Person> personIt2 = personUnifier.findall();

Ludwig Ostermayer (University of Wurzburg) Seamless Cooperation of Java and Prolog 04.08.2015