AS.hs revision c298a419605037f5352b5ad0f67b3e06db094051
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance{-# LANGUAGE DeriveDataTypeable #-}
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance{- |
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceModule : $Header$
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceCopyright : (c) Heng Jiang, Uni Bremen 2004-2007
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceLicense : GPLv2 or higher, see LICENSE.txt
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceMaintainer : Christian.Maeder@dfki.de
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceStability : provisional
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancePortability : non-portable(deriving Typeable)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceThis module defines all the data types for the functional style Syntax
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceof OWL 1.1.
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceIt is modeled after the W3C document:
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance<http://www.w3.org/Submission/2006/SUBM-owl11-owl_specification-20061219/>
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-}
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancemodule OWL2.AS where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Common.Keywords
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Common.Id (GetRange)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport OWL.Keywords
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport OWL.ColonKeywords
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport qualified Data.Map as Map
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Data.Typeable
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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , namespaceUri :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- ^ the associated namespace uri (not printed)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance } deriving (Typeable, Show)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQU (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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancenullQName = QN "" "" False ""
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancedummyQName :: QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancedummyQName = QN "http" "//www.dfki.de/sks/hets/ontology/unamed" True ""
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancemkQName :: String -> QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancemkQName s = nullQName { localPart = s }
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance Eq QName where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance p == q = compare p q == EQ
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance Ord QName where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance compare (QN p1 l1 b1 n1) (QN p2 l2 b2 n2) =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance if null n1 then
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance if null n2 then compare (b1, p1, l1) (b2, p2, l2) else LT
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance else if null n2 then GT else compare (b1, l1, n1) (b2, l2, n2)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype URI = QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype URIreference = QName
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | prefix -> localname
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype Namespace = Map.Map String String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype AnnotationURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype OntologyURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype DatatypeURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype OwlClassURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype ObjectPropertyURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype DataPropertyURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype IndividualURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype ImportURI = URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Syntax of Ontologies
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Annotation =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Annotation AnnotationURI AnnotationBody
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata AnnotationBody =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance OntIDorRef URI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | AnnotationDataLiteral DataLiteral
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | AnnotationIndividual Individual
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata PlainLiteral = PlainLiteral LexicalForm (Maybe LanguageTag)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata TypedLiteral = TypedLiteral LexicalForm URIreference
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata DataLiteral = TypedData TypedLiteral | PlainData PlainLiteral
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata OntologyFile = OntologyFile
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance { namespaces :: Namespace
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , ontology :: Ontology
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance } deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance GetRange OntologyFile
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Ontology = Ontology
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance { uri :: OntologyURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , importsList :: [ImportURI]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , annotationsList :: [Annotation]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance , axiomsList :: [Axiom]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance } deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype OntologyMap = Map.Map String OntologyFile
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata EntityType =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Datatype
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Class
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectProperty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataProperty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | AnnotationProperty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | NamedIndividual
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Enum, Bounded, Show, Read, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Syntax of Entities
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Entity = Entity EntityType URI deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance GetRange Entity
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceentityTypes :: [EntityType]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceentityTypes = [minBound .. maxBound]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | symbol items for hets
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata SymbItems = SymbItems (Maybe EntityType) [URI]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata SymbMapItems = SymbMapItems (Maybe EntityType) [(URI, Maybe URI)]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | raw symbols
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata RawSymb = ASymbol Entity | AnUri URI deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype LexicalForm = String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype LanguageTag = String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata TypedOrUntyped = Typed URIreference | Untyped LanguageTag
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancecTypeS :: String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel MancecTypeS = "^^"
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | a lexical representation either with an "^^" URI (typed) or
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- an optional language tag starting with "\@" (untyped)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Constant = Constant LexicalForm TypedOrUntyped
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Object and Data Property Expressions
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype InverseObjectProperty = ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata ObjectPropertyExpression =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance OpURI ObjectPropertyURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | InverseOp InverseObjectProperty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype DataPropertyExpression = DataPropertyURI
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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Syntax of Data Range
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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, 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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype RestrictionValue = Constant
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata DataRange =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance DRDatatype DatatypeURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataComplementOf DataRange
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataOneOf [Constant] -- min. 1 constant
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DatatypeRestriction DataRange [(DatatypeFacet, RestrictionValue)]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Syntax of Entity Annotations
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype AnnotationsForAxiom = Annotation
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype AnnotationsForEntity = Annotation
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata EntityAnnotation =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance EntityAnnotation [AnnotationsForAxiom] Entity [AnnotationsForEntity]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | Syntax of Classes
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 JunctionType = UnionOf | IntersectionOf deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata QuantifierType = AllValuesFrom | SomeValuesFrom deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQuantifierType :: QuantifierType -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowQuantifierType ty = case ty of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance AllValuesFrom -> onlyS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance SomeValuesFrom -> someS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Cardinality a b = Cardinality CardinalityType Int a (Maybe b)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Description =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance OWLClassDescription OwlClassURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectJunction JunctionType [Description] -- min. 2 Descriptions
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectComplementOf Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectOneOf [IndividualURI] -- min. 1 Individual
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectValuesFrom QuantifierType ObjectPropertyExpression Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectExistsSelf ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectHasValue ObjectPropertyExpression IndividualURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectCardinality (Cardinality ObjectPropertyExpression Description)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataValuesFrom
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance QuantifierType DataPropertyExpression [DataPropertyExpression] DataRange
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataHasValue DataPropertyExpression Constant
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataCardinality (Cardinality DataPropertyExpression DataRange)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- Axiom
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype SubClass = Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype SuperClass = Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata SubObjectPropertyExpression =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance OPExpression ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | SubObjectPropertyChain [ObjectPropertyExpression]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- ^ min. 2 ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype SourceIndividualURI = IndividualURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype TargetIndividualURI = IndividualURI
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancetype TargetValue = Constant
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Axiom = -- Annotations can be ignored
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance PlainAxiom [Annotation] PlainAxiom
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | EntityAnno EntityAnnotation
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance GetRange Axiom
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata EquivOrDisjoint = Equivalent | Disjoint deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowEquivOrDisjoint :: EquivOrDisjoint -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowEquivOrDisjoint ed = case ed of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Equivalent -> equivalentToC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Disjoint -> disjointWithC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata ObjDomainOrRange = ObjDomain | ObjRange deriving (Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowObjDomainOrRange :: ObjDomainOrRange -> String
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceshowObjDomainOrRange dr = case dr of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ObjDomain -> domainC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ObjRange -> rangeC
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata DataDomainOrRange = DataDomain Description | DataRange DataRange
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, 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
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Enum, Bounded, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata 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)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata Assertion a b = Assertion a PositiveOrNegative SourceIndividualURI b
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancedata PlainAxiom =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance SubClassOf SubClass SuperClass
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | EquivOrDisjointClasses EquivOrDisjoint [Description] -- min. 2 desc.
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DisjointUnion OwlClassURI [Description] -- min. 2 desc.
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | SubObjectPropertyOf SubObjectPropertyExpression ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | EquivOrDisjointObjectProperties EquivOrDisjoint [ObjectPropertyExpression]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- min. 2 ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectPropertyDomainOrRange ObjDomainOrRange ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | InverseObjectProperties ObjectPropertyExpression ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectPropertyCharacter Character ObjectPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | SubDataPropertyOf DataPropertyExpression DataPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | EquivOrDisjointDataProperties EquivOrDisjoint [DataPropertyExpression]
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance -- min. 2 DataPropertyExpressions
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataPropertyDomainOrRange DataDomainOrRange DataPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | FunctionalDataProperty DataPropertyExpression
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | SameOrDifferentIndividual SameOrDifferent [IndividualURI] -- min. 2 ind.
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ClassAssertion IndividualURI Description
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | ObjectPropertyAssertion
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance (Assertion ObjectPropertyExpression TargetIndividualURI)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | DataPropertyAssertion
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance (Assertion DataPropertyExpression TargetValue)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance | Declaration Entity
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance deriving (Typeable, Show, Eq, Ord)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceemptyOntologyFile :: OntologyFile
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceemptyOntologyFile = OntologyFile Map.empty emptyOntology
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceemptyOntology :: Ontology
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceemptyOntology = Ontology nullQName [] [] []
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceisEmptyOntologyFile :: OntologyFile -> Bool
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceisEmptyOntologyFile (OntologyFile ns onto) =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Map.null ns && isEmptyOntology onto
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceisEmptyOntology :: Ontology -> Bool
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceisEmptyOntology (Ontology (QN _ l _ n) annoList impList axioms) =
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance null l && null n && null annoList && null impList && null axioms