AS.hs revision 44985cbd4eb61dbc348617ebdd44a774e51dac07
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance{- |
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceModule : $Header$
5d801400993c9671010d244646936d8fd435638cChristian MaederCopyright : (c) C. Maeder
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceLicense : GPLv2 or higher, see LICENSE.txt
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceMaintainer : Christian.Maeder@dfki.de
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceStability : provisional
5d801400993c9671010d244646936d8fd435638cChristian MaederPortability : portable
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
5d801400993c9671010d244646936d8fd435638cChristian MaederCommon datatypes for the Functional and Manchester Syntaxes of OWL 2
aa0ca44e856c87db27e61687cbb630f270976da1Felix Gabriel Mance
5d801400993c9671010d244646936d8fd435638cChristian MaederReferences:
5d801400993c9671010d244646936d8fd435638cChristian Maeder <http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Functional-Style_Syntax>
5d801400993c9671010d244646936d8fd435638cChristian Maeder <http://www.w3.org/TR/owl2-manchester-syntax/>
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-}
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Mancemodule OWL2.AS where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Common.Keywords
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maederimport Common.Id
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
feab1106bbee4f2ea2fd48bca7106dd041e4211dFelix Gabriel Manceimport OWL2.Keywords
feab1106bbee4f2ea2fd48bca7106dd041e4211dFelix Gabriel Manceimport OWL2.ColonKeywords
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport qualified Data.Map as Map
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance{- | full or abbreviated IRIs with a possible uri for the prefix
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance or a local part following a hash sign -}
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata QName = QN
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance { namePrefix :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- ^ the name prefix part of a qualified name \"namePrefix:localPart\"
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , localPart :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- ^ the local part of a qualified name \"namePrefix:localPart\"
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , isFullIri :: Bool
0ec1551231bc5dfdcb3f2bd68fec7457fade7bfdFelix Gabriel Mance , expandedIRI :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- ^ the associated namespace uri (not printed)
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder , iriPos :: Range
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder } deriving Show
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maederinstance GetRange QName where
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maeder getRange = iriPos
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maeder
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQN :: QName -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQN q = (if isFullIri q then showQI else showQU) q
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | show QName as abbreviated iri
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQU :: QName -> String
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaedershowQU (QN pre local _ _ _) =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance if null pre then local else pre ++ ":" ++ local
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | show QName in ankle brackets as full iris
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQI :: QName -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQI = ('<' :) . (++ ">") . showQU
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancenullQName :: QName
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaedernullQName = QN "" "" False "" nullRange
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancedummyQName :: QName
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaederdummyQName =
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder QN "http" "//www.dfki.de/sks/hets/ontology/unamed" True "" nullRange
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancemkQName :: String -> QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancemkQName s = nullQName { localPart = s }
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaedersetQRange :: Range -> QName -> QName
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaedersetQRange r q = q { iriPos = r }
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder
ea3f858eb531d981df3ed00beeadd99cf025adecChristian MaedersetPrefix :: String -> QName -> QName
ea3f858eb531d981df3ed00beeadd99cf025adecChristian MaedersetPrefix s q = q { namePrefix = s }
ea3f858eb531d981df3ed00beeadd99cf025adecChristian Maeder
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance Eq QName where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance p == q = compare p q == EQ
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance Ord QName where
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder compare (QN p1 l1 b1 n1 _) (QN p2 l2 b2 n2 _) = case (n1, n2) of
806e8e0fe1a46ce1523c0d7804f1c193321f7981Christian Maeder ("", "") -> compare (b1, p1, l1) (b2, p2, l2)
806e8e0fe1a46ce1523c0d7804f1c193321f7981Christian Maeder ("", _) -> LT
806e8e0fe1a46ce1523c0d7804f1c193321f7981Christian Maeder (_, "") -> GT
806e8e0fe1a46ce1523c0d7804f1c193321f7981Christian Maeder _ -> compare n1 n2 -- compare fully expanded names only
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype IRIreference = QName
dd3c105fcc30b5d6b750d8fbe32250207b996109Felix Gabriel Mancetype IRI = QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | prefix -> localname
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype PrefixMap = Map.Map String String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype LexicalForm = String
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype LanguageTag = String
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype ImportIRI = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype OntologyIRI = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype Class = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype Datatype = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype ObjectProperty = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype DataProperty = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype AnnotationProperty = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype NamedIndividual = IRI
9cb6af1a7632f12b60f592ce5eb2ac51e6bd33bbFelix Gabriel Mancetype Individual = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * LITERALS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Mancedata TypedOrUntyped = Typed Datatype | Untyped (Maybe LanguageTag)
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
a921ae1da1302f673204e7b63cdce01439a9bd5eFelix Gabriel Mancedata Literal = Literal LexicalForm TypedOrUntyped
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
a921ae1da1302f673204e7b63cdce01439a9bd5eFelix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancecTypeS :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancecTypeS = "^^"
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * PROPERTY EXPRESSIONS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Mancetype InverseObjectProperty = ObjectPropertyExpression
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Mance
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maederdata ObjectPropertyExpression = ObjectProp ObjectProperty
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder | ObjectInverseOf InverseObjectProperty
5d801400993c9671010d244646936d8fd435638cChristian Maeder deriving (Show, Eq, Ord)
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype DataPropertyExpression = DataProperty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | data type strings (some are not listed in the grammar)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancedatatypeKeys :: [String]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancedatatypeKeys =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance [ booleanS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , dATAS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , decimalS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , floatS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , integerS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , negativeIntegerS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , nonNegativeIntegerS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , nonPositiveIntegerS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , positiveIntegerS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , stringS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , universalS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian MaederisDatatypeKey :: IRI -> Bool
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian MaederisDatatypeKey u =
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian Maeder elem (localPart u) datatypeKeys && elem (namePrefix u) ["", "xsd"]
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian Maeder
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * DATA RANGES
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata DatatypeFacet =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance LENGTH
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MINLENGTH
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MAXLENGTH
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | PATTERN
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MININCLUSIVE
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MINEXCLUSIVE
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MAXINCLUSIVE
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | MAXEXCLUSIVE
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | TOTALDIGITS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | FRACTIONDIGITS
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowFacet :: DatatypeFacet -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowFacet df = case df of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance LENGTH -> lengthS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MINLENGTH -> minLengthS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MAXLENGTH -> maxLengthS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance PATTERN -> patternS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MININCLUSIVE -> lessEq
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MINEXCLUSIVE -> lessS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MAXINCLUSIVE -> greaterEq
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MAXEXCLUSIVE -> greaterS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance TOTALDIGITS -> digitsS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance FRACTIONDIGITS -> fractionS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
962c83276bc80dd04f4a83e47eb81524d5294a4fChristian Maederdata DataRange
5d801400993c9671010d244646936d8fd435638cChristian Maeder = DataType Datatype [(ConstrainingFacet, RestrictionValue)]
5d801400993c9671010d244646936d8fd435638cChristian Maeder | DataJunction JunctionType [DataRange]
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder -- at least two elements in the list
5d801400993c9671010d244646936d8fd435638cChristian Maeder | DataComplementOf DataRange
5d801400993c9671010d244646936d8fd435638cChristian Maeder | DataOneOf [Literal] -- at least one element in the list
5d801400993c9671010d244646936d8fd435638cChristian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancedata JunctionType = UnionOf | IntersectionOf deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype ConstrainingFacet = IRI
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype RestrictionValue = Literal
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * CLASS EXPERSSIONS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancedata QuantifierType = AllValuesFrom | SomeValuesFrom deriving (Show, Eq, Ord)
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel ManceshowQuantifierType :: QuantifierType -> String
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel ManceshowQuantifierType ty = case ty of
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance AllValuesFrom -> onlyS
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance SomeValuesFrom -> someS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata CardinalityType = MinCardinality | MaxCardinality | ExactCardinality
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowCardinalityType :: CardinalityType -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowCardinalityType ty = case ty of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MinCardinality -> minS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance MaxCardinality -> maxS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ExactCardinality -> exactlyS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Cardinality a b = Cardinality CardinalityType Int a (Maybe b)
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancedata ClassExpression =
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance Expression Class
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectJunction JunctionType [ClassExpression] -- min. 2 ClassExpressions
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectComplementOf ClassExpression
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectOneOf [Individual] -- min. 1 Individual
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectValuesFrom QuantifierType ObjectPropertyExpression ClassExpression
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectHasValue ObjectPropertyExpression Individual
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectHasSelf ObjectPropertyExpression
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | ObjectCardinality (Cardinality ObjectPropertyExpression ClassExpression)
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder | DataValuesFrom QuantifierType
a6526952d69bccd048c954eb920493a6a83e78faFelix Gabriel Mance DataPropertyExpression DataRange
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance | DataHasValue DataPropertyExpression Literal
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataCardinality (Cardinality DataPropertyExpression DataRange)
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * ANNOTATIONS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancedata Annotation = Annotation [Annotation] AnnotationProperty AnnotationValue
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder deriving (Show, Eq, Ord)
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
962c83276bc80dd04f4a83e47eb81524d5294a4fChristian Maederdata AnnotationValue
5d801400993c9671010d244646936d8fd435638cChristian Maeder = AnnValue IRI
5d801400993c9671010d244646936d8fd435638cChristian Maeder | AnnValLit Literal
5d801400993c9671010d244646936d8fd435638cChristian Maeder deriving (Show, Eq, Ord)
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * ENTITIES
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mancedata Entity = Entity EntityType IRI deriving (Show, Eq, Ord)
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maederinstance GetRange Entity where
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder getRange (Entity _ iri) = iriPos iri
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mancedata EntityType =
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance Datatype
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance | Class
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance | ObjectProperty
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance | DataProperty
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance | AnnotationProperty
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance | NamedIndividual
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance deriving (Enum, Bounded, Show, Read, Eq, Ord)
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel ManceshowEntityType :: EntityType -> String
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel ManceshowEntityType e = case e of
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance Datatype -> datatypeC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance Class -> classC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance ObjectProperty -> objectPropertyC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance DataProperty -> dataPropertyC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance AnnotationProperty -> annotationPropertyC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance NamedIndividual -> individualC
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel ManceentityTypes :: [EntityType]
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel ManceentityTypes = [minBound .. maxBound]
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
1435782fda52a2898ea74e99088351d4f5b450dcChristian Maeder-- * CASES
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype SourceIndividual = Individual
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype TargetIndividual = Individual
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancetype TargetValue = Literal
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mancedata EquivOrDisjoint = Equivalent | Disjoint
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance deriving (Show, Eq, Ord)
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel ManceshowEquivOrDisjoint :: EquivOrDisjoint -> String
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel ManceshowEquivOrDisjoint ed = case ed of
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance Equivalent -> equivalentToC
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance Disjoint -> disjointWithC
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel Mancedata DomainOrRange = ADomain | ARange deriving (Show, Eq, Ord)
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel Mance
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel ManceshowDomainOrRange :: DomainOrRange -> String
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel ManceshowDomainOrRange dr = case dr of
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel Mance ADomain -> domainC
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel Mance ARange -> rangeC
bf47922605c34ddeb05f77188da395945ac2a2c8Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel Mancedata Relation =
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance EDRelation EquivOrDisjoint
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder | SubPropertyOf
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder | InverseOf
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder | SubClass
f853560cb2b56c631af268adec9dd0c1f518ffd8Felix Gabriel Mance | Types
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance | DRRelation DomainOrRange
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel Mance | SDRelation SameOrDifferent
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
aa64389ee694577d9e665cf57331129000072a79Felix Gabriel ManceshowRelation :: Relation -> String
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel ManceshowRelation r = case r of
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance EDRelation ed -> showEquivOrDisjoint ed
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder SubPropertyOf -> subPropertyOfC
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder InverseOf -> inverseOfC
ba2c0d8be230f0b274cf3e0013e3844a80d9afd4Christian Maeder SubClass -> subClassOfC
f853560cb2b56c631af268adec9dd0c1f518ffd8Felix Gabriel Mance Types -> typesC
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance DRRelation dr -> showDomainOrRange dr
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel Mance SDRelation sd -> showSameOrDifferent sd
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel MancegetDR :: Relation -> DomainOrRange
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel MancegetDR r = case r of
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance DRRelation dr -> dr
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance _ -> error "not domain or range"
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel MancegetED :: Relation -> EquivOrDisjoint
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel MancegetED r = case r of
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance EDRelation ed -> ed
f07079faf4e99014e900c7c99adb5ff7fa106b61Felix Gabriel Mance _ -> error "not domain or range"
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel MancegetSD :: Relation -> SameOrDifferent
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel MancegetSD s = case s of
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel Mance SDRelation sd -> sd
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel Mance _ -> error "not same or different"
a604cbad8e2202147b5c6bb9f2e06ae61162d654Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mancedata DataDomainOrRange = DataDomain ClassExpression | DataRange DataRange
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Character =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Functional
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | InverseFunctional
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Reflexive
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Irreflexive
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Symmetric
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Asymmetric
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Antisymmetric
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Transitive
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder deriving (Enum, Bounded, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
ae9f6ee28850f767319629d3c2e28918698dce3bChristian Maederdata SameOrDifferent = Same | Different deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowSameOrDifferent :: SameOrDifferent -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowSameOrDifferent sd = case sd of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Same -> sameAsC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Different -> differentFromC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata PositiveOrNegative = Positive | Negative deriving (Show, Eq, Ord)