-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathProfilesAndSublogics.hs
75 lines (55 loc) · 1.84 KB
/
ProfilesAndSublogics.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{-# LANGUAGE DeriveDataTypeable #-}
{- |
Module : ./OWL2/ProfilesAndSublogics.hs
Copyright : (c) Felix Gabriel Mance
License : GPLv2 or higher, see LICENSE.txt
Maintainer : f.mance@jacobs-university.de
Stability : provisional
Portability : portable
OWL2 Profiles (EL, QL and RL) + OWL2 complexity analysis
References : <http://www.w3.org/TR/owl2-profiles/>
-}
module OWL2.ProfilesAndSublogics where
import OWL2.AS
import OWL2.Profiles
import OWL2.Sublogic
import OWL2.Sign
import OWL2.Morphism
import Data.Data
import Data.Set (empty)
data ProfSub = ProfSub
{ profiles :: Profiles
, sublogic :: OWLSub
} deriving (Show, Eq, Ord, Typeable, Data)
allProfSubs :: [[ProfSub]]
allProfSubs =
[ [ProfSub p sl | sl <- sls, p <- ps]
| sls <- allSublogics, ps <- allProfiles ]
bottomS :: ProfSub
bottomS = ProfSub bottomProfile slBottom
topS :: ProfSub
topS = ProfSub topProfile slTop
-- | OWL2 DL Sublogic
dlS :: ProfSub
dlS = ProfSub topProfile slDL
maxS :: ProfSub -> ProfSub -> ProfSub
maxS ps1 ps2 = ProfSub (profileMax [profiles ps1, profiles ps2])
(slMax (sublogic ps1) (sublogic ps2))
nameS :: ProfSub -> String
nameS ps = printProfile (profiles ps) ++ "-" ++ slName (sublogic ps)
psAxiom :: Axiom -> ProfSub
psAxiom ax = ProfSub (axiom ax) (slAxiom empty ax)
sSig :: Sign -> ProfSub
sSig s = bottomS {sublogic = slSig s}
sMorph :: OWLMorphism -> ProfSub
sMorph m = bottomS {sublogic = slMor m}
prSign :: ProfSub -> Sign -> Sign
prSign s = prSig (sublogic s)
prMorph :: ProfSub -> OWLMorphism -> OWLMorphism
prMorph s a = a
{ osource = prSign s $ osource a
, otarget = prSign s $ otarget a }
prOntDoc :: ProfSub -> OntologyDocument -> OntologyDocument
prOntDoc ps = prODoc (sublogic ps)
profilesAndSublogic :: OntologyDocument -> ProfSub
profilesAndSublogic odoc = ProfSub (ontologyProfiles odoc) (slODoc odoc)