Profiles.hs revision ce5d83770556362fe2c8b567975c2a3758888358
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance{- |
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceModule : $Header$
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceCopyright : (c) Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceLicense : GPLv2 or higher, see LICENSE.txt
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceMaintainer : f.mance@jacobs-university.de
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceStability : provisional
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancePortability : portable
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceContains : OWL2 Profiles (EL, QL, RL and combinations)
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel ManceReferences : <http://www.w3.org/TR/owl2-profiles/>
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance-}
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mancemodule OWL2.Profiles where
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Manceimport OWL2.AS
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Manceimport OWL2.MS
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Manceimport Common.Id
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Manceimport Data.Maybe
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mancedata CoreProfiles = CoreProfiles {
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance el0 :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance ql0 :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance rl0 :: Bool
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance } deriving (Show, Eq, Ord)
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mancedata AllProfiles = AllProfiles {
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance el :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance ql :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance rl :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elql :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elrl :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance qlrl :: Bool,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance all3 :: Bool
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance } deriving (Show, Eq, Ord)
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel MancebottomProfile :: AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancebottomProfile = AllProfiles False False False False False False False
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel MancetopProfile :: AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancetopProfile = AllProfiles True True True True True True True
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancenoProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancenoProfile = CoreProfiles False False False
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelProfile = CoreProfiles True False False
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceqlProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceqlProfile = CoreProfiles False True False
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancerlProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancerlProfile = CoreProfiles False False True
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelqlProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelqlProfile = CoreProfiles True True False
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelrlProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceelrlProfile = CoreProfiles True False True
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceqlrlProfile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceqlrlProfile = CoreProfiles False True True
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Manceall3Profile :: CoreProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Manceall3Profile = CoreProfiles True True True
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceextendProfile :: CoreProfiles -> AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceextendProfile cp =
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance let e = el0 cp
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance q = ql0 cp
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance r = rl0 cp
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance in bottomProfile {
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance el = e,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance ql = q,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance rl = r,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elql = e || q,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elrl = e || r,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance qlrl = q || r,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance all3 = e || q || r
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance }
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceandProfileList :: [AllProfiles] -> AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceandProfileList pl = bottomProfile {
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance el = all el pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance ql = all ql pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance rl = all rl pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elql = all elql pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance elrl = all elrl pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance qlrl = all qlrl pl,
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance all3 = all all3 pl
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance }
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceminimalCovering :: CoreProfiles -> [AllProfiles] -> AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel ManceminimalCovering c pl = andProfileList [extendProfile c, andProfileList pl]
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancedatatypeRequirement :: Datatype -> AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancedatatypeRequirement dt = topProfile -- needs to be implemented, of course
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Manceliteral :: Literal -> AllProfiles
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Manceliteral l = topProfile -- needs to be implemented
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance
c92573b85930868b709024284c0f13dbcaec9554Felix Gabriel Manceindividual :: Individual -> AllProfiles
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Manceindividual i = if isAnonymous i then extendProfile rlProfile else topProfile
c92573b85930868b709024284c0f13dbcaec9554Felix Gabriel Mance
c92573b85930868b709024284c0f13dbcaec9554Felix Gabriel ManceobjProp :: ObjectPropertyExpression -> AllProfiles
c92573b85930868b709024284c0f13dbcaec9554Felix Gabriel ManceobjProp ope = case ope of
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectInverseOf _ -> extendProfile qlrlProfile
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance _ -> topProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancedataRange :: DataRange -> AllProfiles
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel MancedataRange dr = case dr of
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance DataType dt cfl ->
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance if null cfl then datatypeRequirement dt
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance else bottomProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance DataJunction IntersectionOf drl -> andProfileList $ map dataRange drl
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance DataOneOf ll -> minimalCovering elProfile $ map literal ll
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance _ -> bottomProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel MancesubClass :: ClassExpression -> AllProfiles
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel MancesubClass cex = case cex of
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance Expression c -> if isThing c then extendProfile elqlProfile else topProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectJunction jt cel -> case jt of
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance IntersectionOf -> minimalCovering elrlProfile $ map subClass cel
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance UnionOf -> minimalCovering rlProfile $ map subClass cel
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectOneOf il -> minimalCovering elrlProfile $ map individual il
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectValuesFrom SomeValuesFrom ope ce -> andProfileList [objProp ope,
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance case ce of
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance Expression c -> if isThing c then topProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance else extendProfile elrlProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance _ -> minimalCovering elrlProfile [subClass ce]]
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectHasValue ope i -> minimalCovering elrlProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance [objProp ope, individual i]
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance ObjectHasSelf ope -> minimalCovering elProfile [objProp ope]
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance DataValuesFrom SomeValuesFrom _ dr -> dataRange dr
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance DataHasValue _ l -> literal l
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance _ -> bottomProfile
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance{-
ce5d83770556362fe2c8b567975c2a3758888358Felix Gabriel Mance
c92573b85930868b709024284c0f13dbcaec9554Felix Gabriel Mance
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel MancesubClass :: ClassExpression -> AllProfiles
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel MancesubClass cex = case cex of
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance Expression c -> computeAll [True, True, (not . isThing) c]
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance ObjectJunction jt cel -> case jt of
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance IntersectionOf -> minimalCovering elrl $ map subClass cel
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance UnionOf -> minimalCovering rl $ map subClass cel
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance ObjectOneOf _ -> computeAll elrl
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectValuesFrom SomeValuesFrom _ ce -> case ce of
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance Expression c -> if isThing c then topProfile
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance else computeAll elrl
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance _ -> computeAll elrl
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance ObjectHasValue _ _ -> computeAll elrl
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance ObjectHasSelf _ -> computeAll el
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance DataHasValue _ _ -> computeAll elrl
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance DataValuesFrom SomeValuesFrom _ dr -> bottomProfile -- dataRange dr
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance _ -> bottomProfile
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel MancesuperClass :: ClassExpression -> AllProfiles
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel MancesuperClass cex = case cex of
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance Expression c -> computeAll [True, True, (not . isThing) c]
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectJunction IntersectionOf cel -> anaTable $ map superClass cel
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectComplementOf ce -> minimalCovering qlrl [subClass ce]
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectOneOf _ -> computeAll el
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectValuesFrom qt _ ce -> case qt of
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance SomeValuesFrom -> minimalCovering elql [subClass ce] -- !! check this
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance AllValuesFrom -> minimalCovering rl [superClass ce]
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectHasValue _ _ -> computeAll elrl
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance ObjectCardinality (Cardinality MaxCardinality i _ mce) ->
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance let tf = elem i [0, 1]
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance in minimalCovering rl [[tf, tf, tf, tf, tf, tf, tf],
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance (case mce of
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance Nothing -> topProfile
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance Just ce -> case ce of
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance Expression c -> topProfile
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance _ -> subClass ce)]
ae2e84ab0a53874417f01b792cbc6907ee6d09f6Felix Gabriel Mance-}
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance {- DataValuesFrom AllValuesFrom _ dr -> validDataRangeRL dr
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataHasValue _ _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataCardinality (Cardinality MaxCardinality i _ mdr) -> elem i [0, 1] &&
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance (case mdr of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance Nothing -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance Just dr -> validDataRangeRL dr)
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> False
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance-}
4440f5c4ab1cb6dfd445da97f87a72d87d24c25aFelix Gabriel Mance{-
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidEquivClassRL :: ClassExpression -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidEquivClassRL cex = case cex of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance Expression c -> (not . isThing) c
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ObjectJunction IntersectionOf cel -> all validEquivClassRL cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ObjectHasValue _ _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataHasValue _ _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> False
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidDataRangeRL :: DataRange -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidDataRangeRL dr = case dr of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataType _ cfl -> null cfl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataJunction IntersectionOf drl -> all validDataRangeRL drl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> False
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidEDClassesRL :: Relation -> [ClassExpression] -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidEDClassesRL r cel = case r of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance EDRelation Equivalent -> all validEquivClassRL cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance EDRelation Disjoint -> all validSubClassRL cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> False
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidLfbRL :: Maybe Relation -> Extended -> ListFrameBit -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidLfbRL mr ext lfb = case lfb of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ExpressionBit anl ->
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance let cel = map snd anl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance r = fromMaybe (error "relation needed") mr
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance in case ext of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance Misc _ -> validEDClassesRL r cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ClassEntity c -> case r of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance SubClass -> validSubClassRL c && all validSuperClassRL cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> validEDClassesRL r cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> all validSuperClassRL cel
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance IndividualSameOrDifferent _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ObjectCharacteristics anl ->
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance let cl = map snd anl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance in notElem Reflexive cl && notElem Antisymmetric cl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DataPropRange anl -> all validDataRangeRL $ map snd anl
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidAfbRL :: Extended -> AnnFrameBit -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidAfbRL ext afb = case afb of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance DatatypeBit dr -> validDataRangeRL dr
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ClassDisjointUnion _ -> False
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ClassHasKey _ _ -> case ext of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ClassEntity ce -> validSubClassRL ce
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> False
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance _ -> True
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidFbRL :: Extended -> FrameBit -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidFbRL ext fb = case fb of
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance ListFrameBit mr lfb -> validLfbRL mr ext lfb
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance AnnFrameBit _ afb -> validAfbRL ext afb
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidAxiomRL :: Axiom -> Bool
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel MancevalidAxiomRL (PlainAxiom ext fb) = validFbRL ext fb
808e2693447ecc5a311a2b9de6b81ca07f193778Felix Gabriel Mance-}
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance
fae04f4a69922eb1ddf0f46b34fa15a5a080b693Felix Gabriel Mance