AS.hs revision 1b90322eaf59ded3de24fc891bd67bbd73ec2bfa
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder{- |
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederModule : $Header$
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederCopyright : (c) C. Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederLicense : GPLv2 or higher, see LICENSE.txt
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederMaintainer : Christian.Maeder@dfki.de
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederStability : provisional
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederPortability : portable
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederOWL 2 Functional Syntax constructs
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederReferences:
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder <http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Functional-Style_Syntax>
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder <http://www.w3.org/TR/owl2-manchester-syntax/>
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-}
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maedermodule OWL2.AS where
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport Common.Id
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport Common.Keywords
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport OWL2.ColonKeywords
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport OWL2.Keywords
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport Data.Char (intToDigit)
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport Data.List
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport Data.Maybe (fromJust)
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederimport qualified Data.Map as Map
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederdata IRIType = Full | Abbreviated | NodeID
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder deriving (Show, Eq, Ord)
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder{- | full or abbreviated IRIs with a possible uri for the prefix
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder or a local part following a hash sign -}
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederdata QName = QN
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder { namePrefix :: String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder -- ^ the name prefix part of a qualified name \"namePrefix:localPart\"
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , localPart :: String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder -- ^ the local part of a qualified name \"namePrefix:localPart\"
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , iriType :: IRIType
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , expandedIRI :: String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder -- ^ the associated namespace uri (not printed)
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , iriPos :: Range
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder } deriving Show
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederinstance Eq QName where
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder p == q = compare p q == EQ
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederinstance Ord QName where
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder compare (QN p1 l1 b1 n1 _) (QN p2 l2 b2 n2 _) =
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder if null n1 || null n2 then compare (b1, p1, l1) (b2, p2, l2) else
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder compare n1 n2 -- compare fully expanded names only
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maederinstance GetRange QName where
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder getRange = iriPos
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQN :: QName -> String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQN q = (if iriType q /= Abbreviated then showQI else showQU) q
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-- | show QName as abbreviated iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQU :: QName -> String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQU (QN pre local _ _ _) =
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder if null pre then local else pre ++ ":" ++ local
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-- | show QName in ankle brackets as full iris
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQI :: QName -> String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedershowQI = ('<' :) . (++ ">") . showQU
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedernullQName :: QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedernullQName = QN "" "" Abbreviated "" nullRange
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederdummyQName :: QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederdummyQName =
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder QN "http" "//www.dfki.de/sks/hets/ontology/unamed" Full "" nullRange
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedermkQName :: String -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedermkQName s = nullQName { localPart = s }
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetQRange :: Range -> QName -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetQRange r q = q { iriPos = r }
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetPrefix :: String -> QName -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetPrefix s q = q { namePrefix = s }
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetDatatypePrefix :: QName -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetDatatypePrefix iri = let lp = localPart iri in
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder if lp `elem` xsdKeys
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder then setPrefix "xsd" iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder else if lp `elem` owlNumbers
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder then setPrefix "owl" iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder else case lp of
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder "XMLLiteral" -> setPrefix "rdf" iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder "Literal" -> setPrefix "rdfs" iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder _ -> error $ showQU iri ++ " is not a predefined datatype"
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetReservedPrefix :: QName -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetReservedPrefix iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder | isDatatypeKey iri && null (namePrefix iri) = setDatatypePrefix iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder | isThing iri && null (namePrefix iri) = setPrefix "owl" iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder | otherwise = iri
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetFull :: QName -> QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedersetFull q = q {iriType = Full}
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maedertype IRI = QName
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-- | checks if an IRI is an anonymous individual
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederisAnonymous :: IRI -> Bool
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederisAnonymous iri = iriType iri == NodeID
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-- | checks if a string (bound to be localPart of an IRI) contains \":\/\/\"
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedercssIRI :: String -> IRIType
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaedercssIRI iri = if isInfixOf "://" iri then Full else Abbreviated
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder-- | prefix -> localname
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maedertype PrefixMap = Map.Map String String
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederpredefPrefixes :: PrefixMap
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian MaederpredefPrefixes = Map.fromList
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder [ ("owl", "http://www.w3.org/2002/07/owl#")
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , ("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , ("rdfs", "http://www.w3.org/2000/01/rdf-schema#")
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , ("xsd", "http://www.w3.org/2001/XMLSchema#")
acabd9ab36e1870f6f02c513bcfbfd10ffd118e0Christian Maeder , ("", showQU dummyQName ++ "#") ]
type LexicalForm = String
type LanguageTag = String
type ImportIRI = IRI
type OntologyIRI = IRI
type Class = IRI
type Datatype = IRI
type ObjectProperty = IRI
type DataProperty = IRI
type AnnotationProperty = IRI
type NamedIndividual = IRI
type Individual = IRI
data EquivOrDisjoint = Equivalent | Disjoint
deriving (Show, Eq, Ord)
showEquivOrDisjoint :: EquivOrDisjoint -> String
showEquivOrDisjoint ed = case ed of
Equivalent -> equivalentToC
Disjoint -> disjointWithC
data DomainOrRange = ADomain | ARange
deriving (Show, Eq, Ord)
showDomainOrRange :: DomainOrRange -> String
showDomainOrRange dr = case dr of
ADomain -> domainC
ARange -> rangeC
data SameOrDifferent = Same | Different
deriving (Show, Eq, Ord)
showSameOrDifferent :: SameOrDifferent -> String
showSameOrDifferent sd = case sd of
Same -> sameAsC
Different -> differentFromC
data Relation =
EDRelation EquivOrDisjoint
| SubPropertyOf
| InverseOf
| SubClass
| Types
| DRRelation DomainOrRange
| SDRelation SameOrDifferent
deriving (Show, Eq, Ord)
showRelation :: Relation -> String
showRelation r = case r of
EDRelation ed -> showEquivOrDisjoint ed
SubPropertyOf -> subPropertyOfC
InverseOf -> inverseOfC
SubClass -> subClassOfC
Types -> typesC
DRRelation dr -> showDomainOrRange dr
SDRelation sd -> showSameOrDifferent sd
getED :: Relation -> EquivOrDisjoint
getED r = case r of
EDRelation ed -> ed
_ -> error "not domain or range"
getDR :: Relation -> DomainOrRange
getDR r = case r of
DRRelation dr -> dr
_ -> error "not domain or range"
getSD :: Relation -> SameOrDifferent
getSD s = case s of
SDRelation sd -> sd
_ -> error "not same or different"
data Character =
Functional
| InverseFunctional
| Reflexive
| Irreflexive
| Symmetric
| Asymmetric
| Antisymmetric
| Transitive
deriving (Enum, Bounded, Show, Eq, Ord)
data PositiveOrNegative = Positive | Negative
deriving (Show, Eq, Ord)
data QuantifierType = AllValuesFrom | SomeValuesFrom
deriving (Show, Eq, Ord)
showQuantifierType :: QuantifierType -> String
showQuantifierType ty = case ty of
AllValuesFrom -> onlyS
SomeValuesFrom -> someS
checkPredef :: [String] -> String -> IRI -> Bool
checkPredef sl pref u =
localPart u `elem` sl && elem (namePrefix u) ["", pref]
|| showQU u `elem` map (Map.findWithDefault
(error $ "wrong predefined prefix: " ++ show pref)
pref predefPrefixes ++) sl
owlSomething :: [String]
owlSomething = ["Thing", "Nothing"]
isThing :: IRI -> Bool
isThing = checkPredef owlSomething "owl"
xsdNumbers :: [String]
xsdNumbers = [integerS, negativeIntegerS, nonNegativeIntegerS,
nonPositiveIntegerS, positiveIntegerS, decimalS, doubleS, floatS,
longS, intS, shortS, byteS, unsignedLongS, unsignedIntS, unsignedShortS,
unsignedByteS]
owlNumbers :: [String]
owlNumbers = [realS, rationalS]
xsdStrings :: [String]
xsdStrings = [stringS, ncNameS, nameS, nmTokenS, tokenS, languageS,
normalizedStringS]
xsdKeys :: [String]
xsdKeys = [booleanS, dATAS, hexBinaryS, base64BinaryS,
dateTimeS, dateTimeStampS, anyURI] ++ xsdNumbers ++ xsdStrings
nonXSDKeys :: [String]
nonXSDKeys = [realS, rationalS, xmlLiteral, rdfsLiteral]
-- | data type strings (some are not listed in the grammar)
datatypeKeys :: [String]
datatypeKeys = xsdKeys ++ nonXSDKeys
getDataType :: Datatype -> String
getDataType dt =
if namePrefix dt `elem` ["", "xsd"]
then localPart dt
else fromJust $ stripPrefix
"http://www.w3.org/2001/XMLSchema#" $ showQU dt
isDatatypeKey :: IRI -> Bool
isDatatypeKey iri = any (\ (l, p) -> checkPredef l p iri) [(xsdKeys, "xsd"),
(owlNumbers, "owl"), ([xmlLiteral], "rdf"), ([rdfsLiteral], "rdfs")]
isOWLSmth :: [String] -> IRI -> Bool
isOWLSmth sl = checkPredef sl "xsd"
data DatatypeType = OWL2Number | OWL2String | OWL2Bool | Other
deriving (Show, Eq, Ord)
datatypeType :: IRI -> DatatypeType
datatypeType iri = case isDatatypeKey iri of
True
| isOWLSmth [booleanS] iri -> OWL2Bool
| isOWLSmth xsdNumbers iri -> OWL2Number
| isOWLSmth [stringS] iri -> OWL2String
| otherwise -> Other
False -> Other
data DatatypeFacet =
LENGTH
| MINLENGTH
| MAXLENGTH
| PATTERN
| LANGRANGE
| MININCLUSIVE
| MINEXCLUSIVE
| MAXINCLUSIVE
| MAXEXCLUSIVE
| TOTALDIGITS
| FRACTIONDIGITS
deriving (Show, Eq, Ord)
showFacet :: DatatypeFacet -> String
showFacet df = case df of
LENGTH -> lengthS
MINLENGTH -> minLengthS
MAXLENGTH -> maxLengthS
PATTERN -> patternS
LANGRANGE -> langRangeS
MININCLUSIVE -> lessEq
MINEXCLUSIVE -> lessS
MAXINCLUSIVE -> greaterEq
MAXEXCLUSIVE -> greaterS
TOTALDIGITS -> digitsS
FRACTIONDIGITS -> fractionS
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 (Show, Eq, Ord)
data JunctionType = UnionOf | IntersectionOf
deriving (Show, Eq, Ord)
type ConstrainingFacet = IRI
type RestrictionValue = Literal
-- * ENTITIES
data Entity = Entity EntityType IRI deriving (Show, Eq, Ord)
instance GetRange Entity where
getRange (Entity _ iri) = iriPos iri
data EntityType =
Datatype
| Class
| ObjectProperty
| DataProperty
| AnnotationProperty
| NamedIndividual
deriving (Enum, Bounded, Show, Read, Eq, Ord)
showEntityType :: EntityType -> String
showEntityType e = case e of
Datatype -> datatypeC
Class -> classC
ObjectProperty -> objectPropertyC
DataProperty -> dataPropertyC
AnnotationProperty -> annotationPropertyC
NamedIndividual -> individualC
entityTypes :: [EntityType]
entityTypes = [minBound .. maxBound]
cutIRI :: Entity -> IRI
cutIRI (Entity _ iri) = iri
-- * LITERALS
data TypedOrUntyped = Typed Datatype | Untyped (Maybe LanguageTag)
deriving (Show, Eq, Ord)
data Literal = Literal LexicalForm TypedOrUntyped | NumberLit FloatLit
deriving (Show, Eq, Ord)
-- | non-negative integers given by the sequence of digits
data NNInt = NNInt [Int] deriving (Eq, Ord)
instance Show NNInt where
show (NNInt l) = map intToDigit l
zeroNNInt :: NNInt
zeroNNInt = NNInt []
isZeroNNInt :: NNInt -> Bool
isZeroNNInt (NNInt l) = null l
data IntLit = IntLit
{ absInt :: NNInt
, isNegInt :: Bool }
deriving (Eq, Ord)
instance Show IntLit where
show (IntLit n b) = (if b then ('-' :) else id) $ show n
zeroInt :: IntLit
zeroInt = IntLit zeroNNInt False
isZeroInt :: IntLit -> Bool
isZeroInt (IntLit n _) = isZeroNNInt n
negNNInt :: Bool -> NNInt -> IntLit
negNNInt b n = IntLit n b
negInt :: IntLit -> IntLit
negInt (IntLit n b) = IntLit n $ not b
data DecLit = DecLit
{ truncDec :: IntLit
, fracDec :: NNInt }
deriving (Eq, Ord)
instance Show DecLit where
show (DecLit t f) = show t
++ if isZeroNNInt f then "" else
'.' : show f
isDecInt :: DecLit -> Bool
isDecInt = isZeroNNInt . fracDec
negDec :: Bool -> DecLit -> DecLit
negDec b (DecLit t f) = DecLit (if b then negInt t else t) f
data FloatLit = FloatLit
{ floatBase :: DecLit
, floatExp :: IntLit }
deriving (Eq, Ord)
instance Show FloatLit where
show (FloatLit b e) = show b
++ if isZeroInt e then "" else
'E' : show e ++ "F"
isFloatDec :: FloatLit -> Bool
isFloatDec = isZeroInt . floatExp
isFloatInt :: FloatLit -> Bool
isFloatInt f = isFloatDec f && isDecInt (floatBase f)
floatToInt :: FloatLit -> IntLit
floatToInt = truncDec . floatBase
intToDec :: IntLit -> DecLit
intToDec i = DecLit i zeroNNInt
decToFloat :: DecLit -> FloatLit
decToFloat d = FloatLit d zeroInt
intToFloat :: IntLit -> FloatLit
intToFloat = decToFloat . intToDec
abInt :: IntLit -> IntLit
abInt int = int {isNegInt = False}
abDec :: DecLit -> DecLit
abDec dec = dec {truncDec = abInt $ truncDec dec}
abFloat :: FloatLit -> FloatLit
abFloat f = f {floatBase = abDec $ floatBase f}
isNegDec :: DecLit -> Bool
isNegDec d = isNegInt $ truncDec d
numberName :: FloatLit -> String
numberName f
| isFloatInt f = integerS
| isFloatDec f = decimalS
| otherwise = floatS
cTypeS :: String
cTypeS = "^^"
-- * PROPERTY EXPRESSIONS
type InverseObjectProperty = ObjectPropertyExpression
data ObjectPropertyExpression = ObjectProp ObjectProperty
| ObjectInverseOf InverseObjectProperty
deriving (Show, Eq, Ord)
type DataPropertyExpression = DataProperty
-- * DATA RANGES
data DataRange =
DataType Datatype [(ConstrainingFacet, RestrictionValue)]
| DataJunction JunctionType [DataRange]
| DataComplementOf DataRange
| DataOneOf [Literal]
deriving (Show, Eq, Ord)
-- * CLASS EXPERSSIONS
data ClassExpression =
Expression Class
| ObjectJunction JunctionType [ClassExpression]
| ObjectComplementOf ClassExpression
| ObjectOneOf [Individual]
| ObjectValuesFrom QuantifierType ObjectPropertyExpression ClassExpression
| ObjectHasValue ObjectPropertyExpression Individual
| ObjectHasSelf ObjectPropertyExpression
| ObjectCardinality (Cardinality ObjectPropertyExpression ClassExpression)
| DataValuesFrom QuantifierType DataPropertyExpression DataRange
| DataHasValue DataPropertyExpression Literal
| DataCardinality (Cardinality DataPropertyExpression DataRange)
deriving (Show, Eq, Ord)
-- * ANNOTATIONS
data Annotation = Annotation [Annotation] AnnotationProperty AnnotationValue
deriving (Show, Eq, Ord)
data AnnotationValue =
AnnValue IRI
| AnnValLit Literal
deriving (Show, Eq, Ord)