Parse.hs revision 44985cbd4eb61dbc348617ebdd44a774e51dac07
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder{- |
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens ElknerModule : $Header$
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederDescription : Manchester syntax parser for OWL 2
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederCopyright : (c) DFKI GmbH, Uni Bremen 2007-2010
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuLicense : GPLv2 or higher, see LICENSE.txt
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederMaintainer : Christian.Maeder@dfki.de
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederStability : provisional
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederPortability : portable
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederContains : Parser for the Manchester Syntax into Abstract Syntax of OWL 2
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederReferences : <http://www.w3.org/TR/2009/NOTE-owl2-manchester-syntax-20091027/>
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder-}
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maedermodule OWL2.Parse where
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport OWL2.AS
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport OWL2.Symbols
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport OWL2.Keywords
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport OWL2.ColonKeywords
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Common.Keywords
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederimport Common.Id
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederimport Common.Lexer
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroederimport Common.Parsec
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Common.AnnoParser (commentLine)
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Common.Token (criticalKeywords)
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Common.Utils (nubOrd)
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Text.ParserCombinators.Parsec
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederimport Data.Char
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maedertype URI = IRI
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maedercharacters :: [Character]
3d3889e0cefcdce9b3f43c53aaa201943ac2e895Jonathan von Schroedercharacters = [minBound .. maxBound]
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder-- | OWL and CASL structured keywords including 'andS' and 'notS'
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederowlKeywords :: [String]
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederowlKeywords = notS : stringS : map show entityTypes
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder ++ map show characters ++ keywords ++ criticalKeywords
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederncNameStart :: Char -> Bool
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederncNameStart c = isAlpha c || c == '_'
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder-- | rfc3987 plus '+' from scheme (scheme does not allow the dots)
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederncNameChar :: Char -> Bool
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederncNameChar c = isAlphaNum c || elem c ".+-_\183"
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederprefix :: CharParser st String
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederprefix = satisfy ncNameStart <:> many (satisfy ncNameChar)
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederiunreserved :: Char -> Bool
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederiunreserved c = isAlphaNum c || elem c "-._~" || ord c >= 160 && ord c <= 55295
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder-- maybe lower case hex-digits should be illegal
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederpctEncoded :: CharParser st String
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederpctEncoded = char '%' <:> hexDigit <:> single hexDigit
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder{- comma and parens are removed here
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder but would cause no problems for full IRIs within angle brackets -}
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaedersubDelims :: Char -> Bool
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaedersubDelims c = elem c "!$&'*+;="
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederiunreservedSubDelims :: String -> CharParser st Char
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederiunreservedSubDelims cs =
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder satisfy $ \ c -> iunreserved c || subDelims c || elem c cs
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederiunreservedPctEncodedSubDelims :: String -> CharParser st String
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederiunreservedPctEncodedSubDelims cs =
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder single (iunreservedSubDelims cs) <|> pctEncoded
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederipChar :: CharParser st String
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian MaederipChar = iunreservedPctEncodedSubDelims ":@"
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederifragment :: CharParser st String
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederifragment = flat $ many (ipChar <|> single (char '/' <|> char '?'))
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maeder
c3ebe5e0a6545997d56e4156de02d00518c71c0cChristian Maederiquery :: CharParser st String
de4e22f27c1e1c6e0efbc72ffe1670f74181e49eChristian Maederiquery = ifragment -- ignore iprivate
iregName :: CharParser st String
iregName = flat $ many $ iunreservedPctEncodedSubDelims ""
iuserinfo :: CharParser st String
iuserinfo = flat $ many $ iunreservedPctEncodedSubDelims ":"
-- | parse zero or at most n consecutive arguments
atMost :: Int -> GenParser tok st a -> GenParser tok st [a]
atMost n p = if n <= 0 then return [] else
p <:> atMost (n - 1) p <|> return []
-- | parse at least one but at most n conse
atMost1 :: Int -> GenParser tok st a -> GenParser tok st [a]
atMost1 n p = p <:> atMost (n - 1) p
decOctet :: CharParser st String
decOctet = atMost 3 digit
`checkWith` \ s -> let v = value 10 s in v <= 255 &&
(if v == 0 then s == "0" else take 1 s /= "0")
iPv4Adress :: CharParser st String
iPv4Adress = decOctet <++> string "."
<++> decOctet <++> string "."
<++> decOctet <++> string "."
<++> decOctet
ihost :: CharParser st String
ihost = iregName <|> iPv4Adress -- or ipLiteral
port :: CharParser st String
port = many digit
iauthority :: CharParser st String
iauthority = optionL (try $ iuserinfo <++> string "@") <++> ihost
<++> optionL (char ':' <:> port)
isegment :: CharParser st String
isegment = flat $ many ipChar
isegmentNz :: CharParser st String
isegmentNz = flat $ many1 ipChar
ipathAbempty :: CharParser st String
ipathAbempty = flat $ many (char '/' <:> isegment)
ipathAbsolute :: CharParser st String
ipathAbsolute = char '/' <:> optionL (isegmentNz <++> ipathAbempty)
{- within abbreviated IRIs only ipath-noscheme should be used
that excludes colons via isegment-nz-nc -}
ipathRootless :: CharParser st String
ipathRootless = isegmentNz <++> ipathAbempty
iauthorityWithPath :: CharParser st String
iauthorityWithPath = tryString "//" <++> iauthority <++> ipathAbempty
optQueryOrFrag :: CharParser st String
optQueryOrFrag = optionL (char '?' <:> iquery)
<++> optionL (char '#' <:> ifragment)
-- | covers irelative-part (therefore we omit curie)
ihierPart :: CharParser st String
ihierPart =
iauthorityWithPath <|> ipathAbsolute <|> ipathRootless
hierPartWithOpts :: CharParser st String
hierPartWithOpts = ihierPart <++> optQueryOrFrag
skips :: CharParser st a -> CharParser st a
skips = (<< skipMany
(forget space <|> forget commentLine <|> nestCommentOut <?> ""))
abbrIriNoPos :: CharParser st QName
abbrIriNoPos = try $ do
pre <- try $ prefix << char ':'
r <- hierPartWithOpts
return nullQName { namePrefix = pre, localPart = r }
<|> fmap mkQName hierPartWithOpts
abbrIri :: CharParser st QName
abbrIri = do
p <- getPos
q <- abbrIriNoPos
return q { iriPos = Range [p] }
fullIri :: CharParser st QName
fullIri = do
char '<'
QN pre r _ _ p <- abbrIri
char '>'
return $ QN pre r True "" p
uriQ :: CharParser st QName
uriQ = fullIri <|> abbrIri
uriP :: CharParser st QName
uriP =
skips $ try $ checkWithUsing showQN uriQ $ \ q -> let p = namePrefix q in
if null p then notElem (localPart q) owlKeywords
else notElem p $ map (takeWhile (/= ':'))
$ colonKeywords
++ [ show d ++ e | d <- equivOrDisjointL, e <- [classesC, propertiesC]]
-- | parse a possibly kinded list of comma separated uris aka symbols
symbItems :: GenParser Char st SymbItems
symbItems = do
m <- optionMaybe entityType
uris <- symbs
return $ SymbItems m uris
-- | parse a comma separated list of uris
symbs :: GenParser Char st [URI]
symbs = uriP >>= \ u -> do
commaP `followedWith` uriP
us <- symbs
return $ u : us
<|> return [u]
-- | parse a possibly kinded list of comma separated symbol pairs
symbMapItems :: GenParser Char st SymbMapItems
symbMapItems = do
m <- optionMaybe entityType
uris <- symbPairs
return $ SymbMapItems m uris
-- | parse a comma separated list of uri pairs
symbPairs :: GenParser Char st [(URI, Maybe URI)]
symbPairs = uriPair >>= \ u -> do
commaP `followedWith` uriP
us <- symbPairs
return $ u : us
<|> return [u]
uriPair :: GenParser Char st (URI, Maybe URI)
uriPair = uriP >>= \ u -> do
pToken $ toKey mapsTo
u2 <- uriP
return (u, Just u2)
<|> return (u, Nothing)
datatypeUri :: CharParser st QName
datatypeUri = fmap mkQName (choice $ map keyword datatypeKeys) <|> uriP
optSign :: CharParser st String
optSign = optionL (single $ oneOf "+-")
postDecimal :: CharParser st String
postDecimal = char '.' <:> getNumber
fullDecimal :: CharParser st String
fullDecimal = getNumber <++> optionL postDecimal
decimalLit :: CharParser st String
decimalLit = optSign <++> fullDecimal
floatingPointLit :: CharParser st String
floatingPointLit = optSign <++> (fullDecimal <|> postDecimal)
<++> optionL (oneOf "eE" <:> optSign <++> getNumber)
<< oneOf "fF"
languageTag :: CharParser st String
languageTag = atMost1 4 letter
<++> flat (many $ char '-' <:> atMost1 8 alphaNum)
withOrWithoutLanguage :: String -> Maybe String
withOrWithoutLanguage x = if x == "" then Nothing else Just x
stringLiteral :: CharParser st Literal
stringLiteral = do
s <- stringLit
do
string cTypeS
d <- datatypeUri
return $ Literal s $ Typed d
<|> do
string asP
t <- optionL $ skips languageTag
return $ Literal s $ Untyped (withOrWithoutLanguage t)
<|> skips (return $ Literal s $ Typed $ mkQName stringS)
literal :: CharParser st Literal
literal = do
f <- skips $ try floatingPointLit
return $ Literal f $ Typed $ mkQName floatS
<|> do
d <- skips decimalLit
return $ Literal d $ Typed $ mkQName
$ if any (== '.') d then decimalS else integerS
<|> stringLiteral
-- * description
owlClassUri :: CharParser st QName
owlClassUri = uriP
individualUri :: CharParser st QName
individualUri = uriP
individual :: CharParser st Individual
individual = individualUri
skipChar :: Char -> CharParser st ()
skipChar = forget . skips . char
parensP :: CharParser st a -> CharParser st a
parensP = between (skipChar '(') (skipChar ')')
bracesP :: CharParser st a -> CharParser st a
bracesP = between (skipChar '{') (skipChar '}')
bracketsP :: CharParser st a -> CharParser st a
bracketsP = between (skipChar '[') (skipChar ']')
commaP :: CharParser st ()
commaP = skipChar ',' >> return ()
sepByComma :: CharParser st a -> CharParser st [a]
sepByComma p = sepBy1 p commaP
-- | parse character case insensitive
ichar :: Char -> CharParser st Char
ichar c = char (toUpper c) <|> char (toLower c) <?> show [c]
-- | plain string parser with skip
pkeyword :: String -> CharParser st ()
pkeyword s = keywordNotFollowedBy s (alphaNum <|> char '/') >> return ()
keywordNotFollowedBy :: String -> CharParser st Char -> CharParser st String
keywordNotFollowedBy s c = skips $ try $ string s << notFollowedBy c
-- | keyword not followed by any alphanum
keyword :: String -> CharParser st String
keyword s = keywordNotFollowedBy s alphaNum
-- base OWLClass excluded
atomic :: CharParser st ClassExpression
atomic = parensP description
<|> fmap ObjectOneOf (bracesP $ sepByComma individual)
objectPropertyExpr :: CharParser st ObjectPropertyExpression
objectPropertyExpr = do
keyword inverseS
fmap ObjectInverseOf objectPropertyExpr
<|> fmap ObjectProp uriP
-- creating the facet-value pairs
facetValuePair :: CharParser st (ConstrainingFacet, RestrictionValue)
facetValuePair = do
df <- choice $ map (\ f -> keyword (showFacet f) >> return f)
[ LENGTH
, MINLENGTH
, MAXLENGTH
, PATTERN
, TOTALDIGITS
, FRACTIONDIGITS ] ++ map
(\ f -> keywordNotFollowedBy (showFacet f) (oneOf "<>=")
>> return f)
[ MININCLUSIVE
, MINEXCLUSIVE
, MAXINCLUSIVE
, MAXEXCLUSIVE ]
rv <- literal
return (facetToIRI df, rv)
facetToIRI :: DatatypeFacet -> ConstrainingFacet
facetToIRI = makeCF . showFacet
makeCF :: String -> ConstrainingFacet
makeCF lp = (mkQName lp) { namePrefix = "xsd"}
-- it returns DataType Datatype or DatatypeRestriction Datatype [facetValuePair]
dataRangeRestriction :: CharParser st DataRange
dataRangeRestriction = do
e <- datatypeUri
option (DataType e []) $ fmap (DataType e) $ bracketsP
$ sepByComma facetValuePair
dataConjunct :: CharParser st DataRange
dataConjunct = fmap (mkDataJunction IntersectionOf)
$ sepBy1 dataPrimary $ keyword andS
dataRange :: CharParser st DataRange
dataRange = fmap (mkDataJunction UnionOf)
$ sepBy1 dataConjunct $ keyword orS
dataPrimary :: CharParser st DataRange
dataPrimary = do
keyword notS
fmap DataComplementOf dataPrimary
<|> fmap DataOneOf (bracesP $ sepByComma literal)
<|> dataRangeRestriction
mkDataJunction :: JunctionType -> [DataRange] -> DataRange
mkDataJunction ty ds = case nubOrd ds of
[] -> error "mkObjectJunction"
[x] -> x
ns -> DataJunction ty ns
-- the input must be "some" or "only" in order for the parsing to succeed
someOrOnly :: CharParser st QuantifierType
someOrOnly = choice
$ map (\ f -> keyword (showQuantifierType f) >> return f)
[AllValuesFrom, SomeValuesFrom]
-- locates the keywords "min" "max" "exact" and their argument
card :: CharParser st (CardinalityType, Int)
card = do
c <- choice $ map (\ f -> keywordNotFollowedBy (showCardinalityType f) letter
>> return f)
[MinCardinality, MaxCardinality, ExactCardinality]
n <- skips getNumber
return (c, value 10 n)
-- tries to parse either a QName or a literal
individualOrConstant :: CharParser st (Either Individual Literal)
individualOrConstant = fmap Right literal <|> fmap Left individual
{- | applies the previous one to a list separated by commas
(the list needs to be all of the same type, of course) -}
individualOrConstantList :: CharParser st (Either [Individual] [Literal])
individualOrConstantList = do
ioc <- individualOrConstant
case ioc of
Left u -> fmap (Left . (u :)) $ optionL
$ commaP >> sepByComma individual
Right c -> fmap (Right . (c :)) $ optionL
$ commaP >> sepByComma literal
primaryOrDataRange :: CharParser st (Either ClassExpression DataRange)
primaryOrDataRange = do
ns <- many $ keyword notS -- allows multiple not before primary
ed <- do
u <- datatypeUri
fmap Left (restrictionAny $ ObjectProp u)
<|> fmap (Right . DataType u)
(bracketsP $ sepByComma facetValuePair)
<|> return (if isDatatypeKey u
then Right $ DataType u []
else Left $ Expression u) -- could still be a datatypeUri
<|> do
e <- bracesP individualOrConstantList
return $ case e of
Left us -> Left $ ObjectOneOf us
Right cs -> Right $ DataOneOf cs
<|> fmap Left restrictionOrAtomic
return $ if even (length ns) then ed else
case ed of
Left d -> Left $ ObjectComplementOf d
Right d -> Right $ DataComplementOf d
mkObjectJunction :: JunctionType -> [ClassExpression] -> ClassExpression
mkObjectJunction ty ds = case nubOrd ds of
[] -> error "mkObjectJunction"
[x] -> x
ns -> ObjectJunction ty ns
restrictionAny :: ObjectPropertyExpression -> CharParser st ClassExpression
restrictionAny opExpr = do
keyword valueS
e <- individualOrConstant
case e of
Left u -> return $ ObjectHasValue opExpr u
Right c -> case opExpr of
ObjectProp dpExpr -> return $ DataHasValue dpExpr c
_ -> unexpected "literal"
<|> do
keyword selfS
return $ ObjectHasSelf opExpr
<|> do -- sugar
keyword onlysomeS
ds <- bracketsP $ sepByComma description
let as = map (ObjectValuesFrom SomeValuesFrom opExpr) ds
o = ObjectValuesFrom AllValuesFrom opExpr
$ mkObjectJunction UnionOf ds
return $ mkObjectJunction IntersectionOf $ o : as
<|> do -- sugar
keyword hasS
iu <- individual
return $ ObjectValuesFrom SomeValuesFrom opExpr $ ObjectOneOf [iu]
<|> do
v <- someOrOnly
pr <- primaryOrDataRange
case pr of
Left p -> return $ ObjectValuesFrom v opExpr p
Right r -> case opExpr of
ObjectProp dpExpr -> return $ DataValuesFrom v dpExpr r
_ -> unexpected $ "dataRange after " ++ showQuantifierType v
<|> do
(c, n) <- card
mp <- optionMaybe primaryOrDataRange
case mp of
Nothing -> return $ ObjectCardinality $ Cardinality c n opExpr Nothing
Just pr -> case pr of
Left p ->
return $ ObjectCardinality $ Cardinality c n opExpr $ Just p
Right r -> case opExpr of
ObjectProp dpExpr ->
return $ DataCardinality $ Cardinality c n dpExpr $ Just r
_ -> unexpected $ "dataRange after " ++ showCardinalityType c
restriction :: CharParser st ClassExpression
restriction = objectPropertyExpr >>= restrictionAny
restrictionOrAtomic :: CharParser st ClassExpression
restrictionOrAtomic = do
opExpr <- objectPropertyExpr
restrictionAny opExpr <|> case opExpr of
ObjectProp euri -> return $ Expression euri
_ -> unexpected "inverse object property"
<|> atomic
optNot :: (a -> a) -> CharParser st a -> CharParser st a
optNot f p = (keyword notS >> fmap f p) <|> p
primary :: CharParser st ClassExpression
primary = optNot ObjectComplementOf restrictionOrAtomic
conjunction :: CharParser st ClassExpression
conjunction = do
curi <- fmap Expression $ try (owlClassUri << keyword thatS)
rs <- sepBy1 (optNot ObjectComplementOf restriction) $ keyword andS
return $ mkObjectJunction IntersectionOf $ curi : rs
<|> fmap (mkObjectJunction IntersectionOf)
(sepBy1 primary $ keyword andS)
description :: CharParser st ClassExpression
description =
fmap (mkObjectJunction UnionOf) $ sepBy1 conjunction $ keyword orS
entityType :: CharParser st EntityType
entityType = choice $ map (\ f -> keyword (show f) >> return f)
entityTypes
{- | same as annotation Target in Manchester Syntax,
named annotation Value in Abstract Syntax -}
annotationValue :: CharParser st AnnotationValue
annotationValue = do
i <- individual
return $ AnnValue i
<|> do
l <- literal
return $ AnnValLit l
equivOrDisjointL :: [EquivOrDisjoint]
equivOrDisjointL = [Equivalent, Disjoint]
equivOrDisjoint :: CharParser st EquivOrDisjoint
equivOrDisjoint = choice
$ map (\ f -> pkeyword (showEquivOrDisjoint f) >> return f)
equivOrDisjointL
subPropertyKey :: CharParser st ()
subPropertyKey = pkeyword subPropertyOfC
characterKey :: CharParser st ()
characterKey = pkeyword characteristicsC
sameOrDifferent :: CharParser st SameOrDifferent
sameOrDifferent = choice
$ map (\ f -> pkeyword (showSameOrDifferent f) >> return f)
[Same, Different]
equivOrDisjointKeyword :: String -> CharParser st EquivOrDisjoint
equivOrDisjointKeyword ext = choice
$ map (\ f -> pkeyword (show f ++ ext) >> return f)
equivOrDisjointL
sameOrDifferentIndu :: CharParser st SameOrDifferent
sameOrDifferentIndu =
(pkeyword sameIndividualC >> return Same)
<|> (pkeyword differentIndividualsC >> return Different)
objectPropertyCharacter :: CharParser st Character
objectPropertyCharacter =
choice $ map (\ f -> keyword (show f) >> return f) characters
domainOrRange :: CharParser st DomainOrRange
domainOrRange = choice
$ map (\ f -> pkeyword (showDomainOrRange f) >> return f)
[ADomain, ARange]
nsEntry :: CharParser st (String, QName)
nsEntry = do
pkeyword prefixC
p <- skips (option "" prefix << char ':')
i <- skips fullIri
return (p, i)
<|> do
pkeyword namespaceC
p <- skips prefix
i <- skips fullIri
return (p, i)
importEntry :: CharParser st QName
importEntry = pkeyword importC >> uriP