[Haskell-cafe] matching types in Haskell
pat browne
Patrick.Browne at comp.dit.ie
Thu Aug 13 12:24:37 EDT 2009
Hi,
I wish to align or match some Haskell types in order to represent a set
of ontologies and their embedded concpts [1]. I am not sure wheather
modules or classes could be used. I have done this task in a language
called Maude[2]. The code is below. I appreciate that Maude is not very
popular so there is a brief description below. This diagram below
represents the semantics of what I am trying to achive. I want to
construct MERGEDONTOLOGY from ONTOLOGY1 and ONTOLOGY2 both of which are
based on COMMON.
MERGEDONTOLOGY
{ Woman, RiverBank, FinancialBank, HumanBeing}
/\ /\
/ \
/ \
/ \
/ \
/ \
/ \
ONTOLOGY1 ONTOLOGY2
{Woman, Bank, Person} {Woman, Bank, Human}
/\ /\
\ /
\ /
\ /
\ /
\ /
\ /
\ /
{Woman , Person}
COMMMON
Each Maude module represents (below) a distinct ontology, each sort (or
type in Haskell) represents a concept. This example includes both
synonyms and homonyms.
I want to align ONTOLOGY1 and ONTOLOGY2 w.r.t COMMON to produce
MERGEDONTOLOGY. The details of the concepts are as follows.
The Woman concept should be the same in all ontologies, there is only
one Woman concept and it is named as such in each ontology.
Hence there should be only one Woman.MERGEDONTOLOGY
There is only one concept HumanBeing.MERGEDONTOLOGY, but there are 3
synonyms Human.ONTOLOGY2, Person.ONTOLOGY1, and Person.COMMON
It would seem that Person.COMMON should be mapped (or renamed?) to
Human.ONTOLOGY2 which in turn is renamed (or mapped) to
HumanBeing.MERGEDONTOLOGY.
The homonyms are Bank.ONTOLOGY1 and Bank.ONTOLOGY2 which should become
distinct entities in RiverBank.MERGEDONTOLOGY and
FinancialBank.MERGEDONTOLOGY
My question is how should this be done in Haskell.
Is there a classes only solution?
Is ther a module only solution?
Or do I need both?
Regards,
Pat
=============================================
Brief description of Maude code
In the Maude Language the module is the basic conceptual unit.
Sorts are declared in modules
Every line ends with a space dot.
In this case each module is bracketed by fth .. endfth
There are various types of mappings between modules.
In this case I used renamings where the syntax is
*( name_in_source_module to name_in_target_module....)
The keyword protecting is a type of inport.
The + symbol between the modules forms a new module that includes all
the information in each of its arguments
==============================
fth COMMON is
sorts Woman Person .
endfth
fth ONTOLOGY1 is
protecting COMMON .
sorts Bank .
endfth
fth ONTOLOGY2 is
protecting COMMON *( sort Person to Human) .
sorts Bank .
endfth
fth MERGEDONTOLOGY is
including (ONTOLOGY1 * (sort Bank to RiverBank,sort Person to
HumanBeing)) + (ONTOLOGY2 * (sort Human to HumanBeing, sort Bank to
FinancialBank)) .
endfth
with the command
show all MERGEDONTOLOGY
the system will produce the following module
fth MERGEDONTOLOGY0 is
sorts Woman HumanBeing FinancialBank RiverBank .
endfth
================================
Reference
[1]Shapes of Alignments Construction, Combination, and Computation by
Oliver Kutz, Till Mossakowsk, and Mihai Codescu
http://www.informatik.uni-bremen.de/~okutz/shapes.pdf
[2] Informa tiom on Maude at: http://maude.cs.uiuc.edu/
More information about the Haskell-Cafe
mailing list