AS.hs revision 097bc9f18b722812d480df0f5c634d09cbca8e21
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder{-# LANGUAGE DeriveDataTypeable #-}
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder{- |
81d182b21020b815887e9057959228546cf61b6bChristian MaederModule : $Header$
62ecb1e7f8fd9573eea8369657de12c7bf9f4f25Christian MaederCopyright : (c) Heng Jiang, Uni Bremen 2004-2007
97018cf5fa25b494adffd7e9b4e87320dae6bf47Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder
3f69b6948966979163bdfe8331c38833d5d90ecdChristian MaederMaintainer : Christian.Maeder@dfki.de
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian MaederStability : provisional
fbb66ee3e170624835b99f7aa91980753cb5b472Christian MaederPortability : non-portable(deriving Typeable)
f3a94a197960e548ecd6520bb768cb0d547457bbChristian Maeder
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian MaederThis module defines all the data types for the functional style Syntax
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maederof OWL 2
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian MaederIt is modeled after the W3C document:
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder<http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Functional-Style_Syntax>
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder-}
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maedermodule OWL2.AS where
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maederimport Common.Keywords
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maederimport Common.Id (GetRange)
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maederimport OWL.Keywords
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maederimport OWL.ColonKeywords
ee9eddfa6953868fd6fbaff0d9ff68675a13675aChristian Maederimport qualified Data.Map as Map
ad270004874ce1d0697fb30d7309f180553bb315Christian Maederimport Data.Typeable
ad270004874ce1d0697fb30d7309f180553bb315Christian Maeder
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder{- | full or abbreviated IRIs with a possible uri for the prefix
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder or a local part following a hash sign -}
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maederdata QName = QN
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maeder { namePrefix :: String
ee9eddfa6953868fd6fbaff0d9ff68675a13675aChristian Maeder -- ^ the name prefix part of a qualified name \"namePrefix:localPart\"
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder , localPart :: String
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maeder -- ^ the local part of a qualified name \"namePrefix:localPart\"
33a5d53a412ba0a4e5847f7538d6da2e22bd116cChristian Maeder , isFullIri :: Bool
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder , namespaceUri :: String
e774ab5733a1d673b123b0e63b14dd533e6fd4fcChristian Maeder -- ^ the associated namespace uri (not printed)
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maeder } deriving (Typeable, Show)
6e39bfd041946fce4982ac89834be73fd1bfb39aChristian Maeder
6e39bfd041946fce4982ac89834be73fd1bfb39aChristian MaedershowQN :: QName -> String
62ecb1e7f8fd9573eea8369657de12c7bf9f4f25Christian MaedershowQN q = (if isFullIri q then showQI else showQU) q
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder-- | show QName as abbreviated iri
b645cf3dc1e449038ed291bbd11fcc6e02b2fc7fChristian MaedershowQU :: QName -> String
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaedershowQU (QN pre local _ _) =
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder if null pre then local else pre ++ ":" ++ local
42c01284bba8d7c8d995c8dfb96ace57d28ed1bcTill Mossakowski
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder-- | show QName in ankle brackets as full iris
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaedershowQI :: QName -> String
2bf209888545860dc77b9c3f2198d00eeab30d20Christian MaedershowQI = ('<' :) . (++ ">") . showQU
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaedernullQName :: QName
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaedernullQName = QN "" "" False ""
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaederdummyQName :: QName
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian MaederdummyQName = QN "http" "//www.dfki.de/sks/hets/ontology/unamed" True ""
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder
715ffaf874309df081d1e1cd8e05073fc1227729Christian MaedermkQName :: String -> QName
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian MaedermkQName s = nullQName { localPart = s }
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maederinstance Eq QName where
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder p == q = compare p q == EQ
ccf3de3d66b521a260e5c22d335c64a48e3f0195Christian Maeder
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maederinstance Ord QName where
e9490701e16d1e8abd995ef876d6f937da93b412Christian Maeder compare (QN p1 l1 b1 n1) (QN p2 l2 b2 n2) =
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder if null n1 then
c44c23429c72f3a709e22a18f2ed6f05fc8cc765Christian Maeder if null n2 then compare (b1, p1, l1) (b2, p2, l2) else LT
ccf3de3d66b521a260e5c22d335c64a48e3f0195Christian Maeder else if null n2 then GT else compare (b1, l1, n1) (b2, l2, n2)
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maeder
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maedertype IRIreference = QName
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maedertype IRI = QName
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maeder
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder-- | prefix -> localname
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maedertype PrefixMap = Map.Map String String
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maedertype NodeID = String
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maedertype LexicalForm = String
2a598ff0c1b7b51c33aee7029b43bc5cfcbea6b8Christian Maedertype LanguageTag = String
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maedertype PrefixName = String
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maedertype ImportIRI = IRI
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maedertype OntologyIRI = IRI
961fc5d08256957f68f245f2723085ced14a0a1fChristian Maedertype Class = IRI
961fc5d08256957f68f245f2723085ced14a0a1fChristian Maedertype Datatype = IRI
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maedertype ObjectProperty = IRI
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maedertype DataProperty = IRI
961fc5d08256957f68f245f2723085ced14a0a1fChristian Maedertype AnnotationProperty = IRI
961fc5d08256957f68f245f2723085ced14a0a1fChristian Maedertype NamedIndividual = IRI
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maedertype AnonymousIndividual = NodeID
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maederdata Individual = NamedInd IRI | AnonymousIndividual AnonymousIndividual
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder deriving (Typeable, Show, Eq, Ord)
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder------------------------
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder-- ONTOLOGIES SYNTAX
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder------------------------
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maederdata OntologyFile = OntologyFile
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder { prefixName :: PrefixMap
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder , ontology :: Ontology
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder } deriving (Typeable, Show, Eq, Ord)
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maederinstance GetRange OntologyFile
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maederdata Ontology = Ontology
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder { uri :: OntologyIRI
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder , importsList :: [ImportIRI]
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder , annotationsList :: [Annotation]
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder , axiomsList :: [Axiom]
715ffaf874309df081d1e1cd8e05073fc1227729Christian Maeder } deriving (Typeable, Show, Eq, Ord)
0ea85310d2beb8aa03cac481ad2a6564e6b8ddbcChristian Maeder
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maedertype OntologyMap = Map.Map String OntologyFile
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder------------------------
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder-- SYMBOL ITEMS FOR HETS
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maeder------------------------
836e72a3c413366ba9801726f3b249c7791cb9caChristian Maeder
836e72a3c413366ba9801726f3b249c7791cb9caChristian Maederdata SymbItems = SymbItems (Maybe EntityType) [IRI]
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maeder deriving (Typeable, Show, Eq)
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maederdata SymbMapItems = SymbMapItems (Maybe EntityType) [(IRI, Maybe IRI)]
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder deriving (Typeable, Show, Eq)
5964438458028e61fdabfa74ca3b4210206cdba6Christian Maeder
5964438458028e61fdabfa74ca3b4210206cdba6Christian Maeder-- | raw symbols
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maederdata RawSymb = ASymbol Entity | AnUri IRI deriving (Typeable, Show, Eq, Ord)
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maeder-------------------------
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder-- LITERALS
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maeder-------------------------
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maeder
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maederdata TypedOrUntyped = Typed Datatype | Untyped (Maybe LanguageTag)
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maeder deriving (Typeable, Show, Eq, Ord)
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
36c6cc568751e4235502cfee00ba7b597dae78dcChristian MaedercTypeS :: String
36c6cc568751e4235502cfee00ba7b597dae78dcChristian MaedercTypeS = "^^"
d48085f765fca838c1d972d2123601997174583dChristian Maeder
797f811e57952d59e73b8cd03b667eef276db972Christian Maeder-- | a lexical representation either with an "^^" URI (typed) or
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maeder-- an optional language tag starting with "\@" (untyped)
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maeder
3daa82a175c7cfabf22455aa77c4beda327404e4Christian Maederdata Literal = Literal LexicalForm TypedOrUntyped
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder deriving (Typeable, Show, Eq, Ord)
3daa82a175c7cfabf22455aa77c4beda327404e4Christian Maeder
3daa82a175c7cfabf22455aa77c4beda327404e4Christian Maeder--------------------------
3daa82a175c7cfabf22455aa77c4beda327404e4Christian Maeder-- PROPERTY EXPRESSIONS
3daa82a175c7cfabf22455aa77c4beda327404e4Christian Maeder--------------------------
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maeder
36c6cc568751e4235502cfee00ba7b597dae78dcChristian Maedertype InverseObjectProperty = ObjectPropertyExpression
5e26bfc8d7b18cf3a3fa7b919b4450fb669f37a5Christian Maeder
bbae6e6ca0de7f2ffbb44d2c8da179f2b717237fChristian Maederdata ObjectPropertyExpression = ObjectProp ObjectProperty | ObjectInverseOf InverseObjectProperty
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maeder deriving (Typeable, Show, Eq, Ord)
6e39bfd041946fce4982ac89834be73fd1bfb39aChristian Maeder
149e43c4a2705a86a0e5fa301ba849fdf19db32eChristian Maedertype DataPropertyExpression = DataProperty
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
1738d16957389457347bee85075d3d33d002158fChristian Maeder-- | data type strings (some are not listed in the grammar)
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian MaederdatatypeKeys :: [String]
6e39bfd041946fce4982ac89834be73fd1bfb39aChristian MaederdatatypeKeys =
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder [ booleanS
89dc77946055c0e4cb4671c4a74c3dcd55ed41a1Christian Maeder , dATAS
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder , decimalS
304c84f22dd78f7979efd81b8fc38c8d2197ed39Christian Maeder , floatS
304c84f22dd78f7979efd81b8fc38c8d2197ed39Christian Maeder , integerS
304c84f22dd78f7979efd81b8fc38c8d2197ed39Christian Maeder , negativeIntegerS
304c84f22dd78f7979efd81b8fc38c8d2197ed39Christian Maeder , nonNegativeIntegerS
304c84f22dd78f7979efd81b8fc38c8d2197ed39Christian Maeder , nonPositiveIntegerS
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder , positiveIntegerS
7de39d39bc1700cc8a9bb9df90b920aad9e18d4aChristian Maeder , stringS
e215ca0377dc79c9bcfb105157ecc4b958bec67bChristian Maeder , universalS
e215ca0377dc79c9bcfb105157ecc4b958bec67bChristian Maeder ]
e215ca0377dc79c9bcfb105157ecc4b958bec67bChristian Maeder
e215ca0377dc79c9bcfb105157ecc4b958bec67bChristian Maeder--------------------------
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder-- DATA RANGES
7de39d39bc1700cc8a9bb9df90b920aad9e18d4aChristian Maeder--------------------------
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder
88ece6e49930670e8fd3ee79c89a2e918d2fbd0cChristian Maederdata DatatypeFacet =
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder LENGTH
7de39d39bc1700cc8a9bb9df90b920aad9e18d4aChristian Maeder | MINLENGTH
2bf209888545860dc77b9c3f2198d00eeab30d20Christian Maeder | MAXLENGTH
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder | PATTERN
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder | MININCLUSIVE
1d589334ba6b4a4cbfb35307a7a732261e77b0cdChristian Maeder | MINEXCLUSIVE
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maeder | MAXINCLUSIVE
aff01ee50b66032469c232e00c945d1fd4f57d1bChristian Maeder | MAXEXCLUSIVE
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder | TOTALDIGITS
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder | FRACTIONDIGITS
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder deriving (Typeable, Show, Eq, Ord)
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian Maeder
bdce0d5f7e435df37670d3720929d97ab0043b6bChristian MaedershowFacet :: DatatypeFacet -> String
showFacet df = case df of
LENGTH -> lengthS
MINLENGTH -> minLengthS
MAXLENGTH -> maxLengthS
PATTERN -> patternS
MININCLUSIVE -> lessEq
MINEXCLUSIVE -> lessS
MAXINCLUSIVE -> greaterEq
MAXEXCLUSIVE -> greaterS
TOTALDIGITS -> digitsS
FRACTIONDIGITS -> fractionS
data DataRange
= DataType Datatype
| DataIntersectionOrUnionOf JunctionType [DataRange] -- at least two elements in the list
| DataComplementOf DataRange
| DataOneOf [Literal] -- at least one element in the list
| DatatypeRestriction Datatype [(ConstrainingFacet, RestrictionValue)] -- at least one element in the list
deriving (Typeable, Show, Eq, Ord)
data JunctionType = UnionOf | IntersectionOf deriving (Show, Eq, Ord)
type ConstrainingFacet = IRI
type RestrictionValue = Literal
---------------------------
-- CLASS EXPERSSIONS
---------------------------
data QuantifierType = AllValuesFrom | SomeValuesFrom deriving (Show, Eq, Ord)
showQuantifierType :: QuantifierType -> String
showQuantifierType ty = case ty of
AllValuesFrom -> onlyS
SomeValuesFrom -> someS
data CardinalityType = MinCardinality | MaxCardinality | ExactCardinality
deriving (Show, Eq, Ord)
showCardinalityType :: CardinalityType -> String
showCardinalityType ty = case ty of
MinCardinality -> minS
MaxCardinality -> maxS
ExactCardinality -> exactlyS
data Cardinality a b = Cardinality CardinalityType Int a (Maybe b)
deriving (Typeable, Show, Eq, Ord)
data ClassExpression =
Expression Class
| ObjectJunction JunctionType [ClassExpression] -- min. 2 ClassExpressions
| ObjectComplementOf ClassExpression
| ObjectOneOf [Individual] -- min. 1 Individual
| ObjectValuesFrom QuantifierType ObjectPropertyExpression ClassExpression
| ObjectHasValue ObjectPropertyExpression Individual
| ObjectHasSelf ObjectPropertyExpression
| ObjectCardinality (Cardinality ObjectPropertyExpression ClassExpression)
| DataValuesFrom
QuantifierType DataPropertyExpression [DataPropertyExpression] DataRange
| DataHasValue DataPropertyExpression Literal
| DataCardinality (Cardinality DataPropertyExpression DataRange)
deriving (Typeable, Show, Eq, Ord)
-------------------
-- ANNOTATIONS
-------------------
data Annotation = Annotation [Annotation] AnnotationProperty AnnotationValue
deriving (Typeable, Show, Eq, Ord)
data AnnotationAxiom
= AnnotationAssertion [Annotation] AnnotationProperty AnnotationSubject AnnotationValue
| SubAnnotationPropertyOf [Annotation] AnnotationProperty AnnotationProperty
| AnnotationPropertyDomainOrRange AnnotationDomainOrRange [Annotation] AnnotationProperty IRI
deriving (Typeable, Show, Eq, Ord)
data AnnotationDomainOrRange = AnnDomain | AnnRange deriving (Show, Eq, Ord)
data AnnotationSubject
= AnnSubIRI IRI
| AnnSubject AnonymousIndividual
deriving (Typeable, Show, Eq, Ord)
data AnnotationValue
= AnnValue AnonymousIndividual
| AnnValIRI IRI
| AnnValLit Literal
deriving (Typeable, Show, Eq, Ord)
---------------------
-- AXIOMS
---------------------
--Entities
data EntityType =
Datatype
| Class
| ObjectProperty
| DataProperty
| AnnotationProperty
| NamedIndividual
deriving (Typeable, Enum, Bounded, Show, Read, Eq, Ord)
-- | Syntax of Entities
data Entity = Entity EntityType IRI deriving (Typeable, Show, Eq, Ord)
instance GetRange Entity
entityTypes :: [EntityType]
entityTypes = [minBound .. maxBound]
type SourceIndividual = Individual
type TargetIndividual = Individual
type TargetValue = Literal
data Axiom = -- Annotations can be ignored
PlainAxiom [Annotation] PlainAxiom
| EntityAnno AnnotationAxiom
deriving (Typeable, Show, Eq, Ord)
instance GetRange Axiom
data EquivOrDisjoint = Equivalent | Disjoint deriving (Show, Eq, Ord)
showEquivOrDisjoint :: EquivOrDisjoint -> String
showEquivOrDisjoint ed = case ed of
Equivalent -> equivalentToC
Disjoint -> disjointWithC
data ObjDomainOrRange = ObjDomain | ObjRange deriving (Show, Eq, Ord)
showObjDomainOrRange :: ObjDomainOrRange -> String
showObjDomainOrRange dr = case dr of
ObjDomain -> domainC
ObjRange -> rangeC
data DataDomainOrRange = DataDomain ClassExpression | DataRange DataRange
deriving (Typeable, Show, Eq, Ord)
data Character =
Functional
| InverseFunctional
| Reflexive
| Irreflexive
| Symmetric
| Asymmetric
| Antisymmetric
| Transitive
deriving (Typeable, Enum, Bounded, Show, Eq, Ord)
data SameOrDifferent = Same | Different deriving (Show, Eq, Ord)
showSameOrDifferent :: SameOrDifferent -> String
showSameOrDifferent sd = case sd of
Same -> sameAsC
Different -> differentFromC
data PositiveOrNegative = Positive | Negative deriving (Show, Eq, Ord)
data Assertion a b = Assertion a PositiveOrNegative SourceIndividual b
deriving (Typeable, Show, Eq, Ord)
data PlainAxiom =
SubClassOf SubClass SuperClass
| EquivOrDisjointClasses EquivOrDisjoint [ClassExpression] -- min. 2 desc.
| DisjointUnion Class [ClassExpression] -- min. 2 desc.
| SubObjectPropertyOf SubObjectPropertyExpression ObjectPropertyExpression
| EquivOrDisjointObjectProperties EquivOrDisjoint [ObjectPropertyExpression] -- min. 2 ObjectPropertyExpression
| ObjectPropertyDomainOrRange ObjDomainOrRange ObjectPropertyExpression ClassExpression
| InverseObjectProperties ObjectPropertyExpression ObjectPropertyExpression
| ObjectPropertyCharacter Character ObjectPropertyExpression
| SubDataPropertyOf DataPropertyExpression DataPropertyExpression
| EquivOrDisjointDataProperties EquivOrDisjoint [DataPropertyExpression] -- min. 2 DataPropertyExpressions
| DataPropertyDomainOrRange DataDomainOrRange DataPropertyExpression
| FunctionalDataProperty DataPropertyExpression
| SameOrDifferentIndividual SameOrDifferent [Individual] -- min. 2 ind.
| ClassAssertion ClassExpression Individual -- arguments are reversed from OWL-1
| ObjectPropertyAssertion (Assertion ObjectPropertyExpression TargetIndividual)
| DataPropertyAssertion (Assertion DataPropertyExpression TargetValue)
| Declaration Entity
| DatatypeDefinition Datatype DataRange
| HasKey ClassExpression [ObjectPropertyExpression] [DataPropertyExpression]
deriving (Typeable, Show, Eq, Ord)
type SubClass = ClassExpression
type SuperClass = ClassExpression
data SubObjectPropertyExpression
= OPExpression ObjectPropertyExpression
| SubObjectPropertyChain [ObjectPropertyExpression] -- min. 2 ObjectPropertyExpression
deriving (Typeable, Show, Eq, Ord)
---------------------
-- ONTOLOGY FILES
---------------------
emptyOntologyFile :: OntologyFile
emptyOntologyFile = OntologyFile Map.empty emptyOntology
emptyOntology :: Ontology
emptyOntology = Ontology nullQName [] [] []
isEmptyOntologyFile :: OntologyFile -> Bool
isEmptyOntologyFile (OntologyFile ns onto) =
Map.null ns && isEmptyOntology onto
isEmptyOntology :: Ontology -> Bool
isEmptyOntology (Ontology (QN _ l _ n) annoList impList axioms) =
null l && null n && null annoList && null impList && null axioms