Module : ./Common/IRI.hs
License : GPLv2 or higher, see LICENSE.txt
from the Network.URI module by Graham Klyne, but is extended to IRI
(3) <http://www.w3.org/TR/rdfa-core/#s_curies>
module Common.IRI
-- * methods from OWL2.AS
import Data.Char
import Data.Data
import Data.Ord (comparing)
import Data.Map as Map (Map, lookup)
import Data.Maybe
import Data.List
import qualified Data.Map as Map
import Control.Monad (when)
import OWL2.ColonKeywords
import OWL2.Keywords
import Common.Id as Id
import Common.Lexer
import Common.Parsec
import Common.Percent
import Common.Token (mixId, comps)
, iriAuthority :: Maybe IRIAuth -- ^ @\/\/anonymous\@www.haskell.org:42@
, iriRegName :: String -- ^ @www.haskell.org@
-- | check that we have a full (possibly expanded) IRI (i.e. for comparisons)
-- compares full/expanded IRI (if expanded) or abbreviated part if not expanded
-- * new functions for OWL.AS
p0 = if hasFullIRI i then Id.incSourceColumn p (-1) else p
, iriRegName = "hets.eu"
, iriPath = stringToId "/ontology/unamed"
-- | Parses a CURIE <http://www.w3.org/TR/rdfa-core/#s_curies>
<http://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName> -}
[[[Above was a comment originally in GHC Network/IRI.hs:
[] -> error $ "Common/IRI.hs: Cannot remove dots from empty id:" ++ show i
> "http://example.com/Root/sub1/name2#frag"
> `relativeFrom` "http://example.com/Root/sub2/name2#frag"
> == "../sub1/name2#frag"
(i.e. results always ends with '/')
case Map.lookup (filter (/= ':') $ prefixName c) prefixMap of