AS.hs revision a921ae1da1302f673204e7b63cdce01439a9bd5e
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz{-# LANGUAGE DeriveDataTypeable #-}
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzModule : $Header$
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzCopyright : (c) Heng Jiang, Uni Bremen 2004-2007
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzLicense : GPLv2 or higher, see LICENSE.txt
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzMaintainer : Christian.Maeder@dfki.de
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzStability : provisional
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzPortability : non-portable(deriving Typeable)
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzThis module defines all the data types for the functional style Syntax
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst SchulzIt is modeled after the W3C document:
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz<http://www.w3.org/TR/2009/REC-owl2-syntax-20091027/#Functional-Style_Syntax>
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulzimport Common.Id (GetRange)
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulzimport qualified Data.Map as Map
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz{- | full or abbreviated IRIs with a possible uri for the prefix
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz or a local part following a hash sign -}
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulzdata QName = QN
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz { namePrefix :: String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu -- ^ the name prefix part of a qualified name \"namePrefix:localPart\"
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz , localPart :: String
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz -- ^ the local part of a qualified name \"namePrefix:localPart\"
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz , isFullIri :: Bool
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz , namespaceUri :: String
fcd50ed0f526645ca50bad2170e3b98b911b7678Ewaryst Schulz -- ^ the associated namespace uri (not printed)
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert Savu } deriving (Typeable, Show)
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavushowQN :: QName -> String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavushowQN q = (if isFullIri q then showQI else showQU) q
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu-- | show QName as abbreviated iri
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst SchulzshowQU :: QName -> String
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert SavushowQU (QN pre local _ _) =
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu if null pre then local else pre ++ ":" ++ local
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu-- | show QName in ankle brackets as full iris
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavushowQI :: QName -> String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavushowQI = ('<' :) . (++ ">") . showQU
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavunullQName :: QName
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavunullQName = QN "" "" False ""
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert SavudummyQName :: QName
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert SavudummyQName = QN "http" "//www.dfki.de/sks/hets/ontology/unamed" True ""
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavumkQName :: String -> QName
ad306df140215d8fb88d14bbb7d685011e0f770bRobert SavumkQName s = nullQName { localPart = s }
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savuinstance Eq QName where
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu p == q = compare p q == EQ
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savuinstance Ord QName where
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu compare (QN p1 l1 b1 n1) (QN p2 l2 b2 n2) =
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert Savu if null n1 then
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert Savu if null n2 then compare (b1, p1, l1) (b2, p2, l2) else LT
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu else if null n2 then GT else compare (b1, l1, n1) (b2, l2, n2)
3051a3502f027f3d7bb750a1d7a6b1b43cdd2a86Robert Savutype IRIreference = QName
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype IRI = QName
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu-- | prefix -> localname
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype PrefixMap = Map.Map String String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype NodeID = String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype LexicalForm = String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype LanguageTag = String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype PrefixName = String
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype ImportIRI = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype OntologyIRI = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype Class = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype Datatype = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype ObjectProperty = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype DataProperty = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype AnnotationProperty = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype NamedIndividual = IRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype AnonymousIndividual = NodeID
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savudata Individual = NamedInd IRI | AnonymousIndividual AnonymousIndividual
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu deriving (Typeable, Show, Eq, Ord)
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu------------------------
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu-- ONTOLOGIES SYNTAX
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu------------------------
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savudata OntologyFile = OntologyFile
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu { prefixName :: PrefixMap
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu , ontology :: Ontology
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu } deriving (Typeable, Show, Eq, Ord)
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savuinstance GetRange OntologyFile
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savudata Ontology = Ontology
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu { uri :: OntologyIRI
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu , importsList :: [ImportIRI]
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu , annotationsList :: [Annotation]
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu , axiomsList :: [Axiom]
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu } deriving (Typeable, Show, Eq, Ord)
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savutype OntologyMap = Map.Map String OntologyFile
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst Schulz------------------------
b3df7e69d4d6066fdfae0a8a2f3b4a161eaaf540Robert Savu-- SYMBOL ITEMS FOR HETS
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst Schulz------------------------
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst Schulzdata SymbItems = SymbItems (Maybe EntityType) [IRI]
ad306df140215d8fb88d14bbb7d685011e0f770bRobert Savu deriving (Typeable, Show, Eq)
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst Schulzdata SymbMapItems = SymbMapItems (Maybe EntityType) [(IRI, Maybe IRI)]
0a03acf9fa28e6ff00f4d7c9c6acbae64cf09c56Ewaryst Schulz deriving (Typeable, Show, Eq)
| DatatypeRestriction Datatype [(ConstrainingFacet, RestrictionValue)] -- at least one element in the list
| EquivOrDisjointObjectProperties EquivOrDisjoint [ObjectPropertyExpression] -- min. 2 ObjectPropertyExpression
| EquivOrDisjointDataProperties EquivOrDisjoint [DataPropertyExpression] -- min. 2 DataPropertyExpressions
emptyOntologyFile = OntologyFile Map.empty emptyOntology
Map.null ns && isEmptyOntology onto