Hets - the Heterogeneous Tool Set

Copyright(c) DFKI GmbH 2012
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerEugen Kuksa <eugenk@informatik.uni-bremen.de>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe

Common.IRI

Contents

Description

This module defines functions for handling IRIs. It was adopted from the Network.URI module by Graham Klyne, but is extended to IRI support [2] and CURIE [3].

Four methods are provided for parsing different kinds of IRI string (as noted in [1], [2]): parseIRI parseIRIReference

An additional method is provided for parsing an abbreviated IRI according to [3]: parseIRICurie

Additionally, classification of full, abbreviated and simple IRI is provided.

The abbreviated syntaxes [3] provide three different kinds of IRI.

References

  1. http://www.ietf.org/rfc/rfc3986.txt
  2. http://www.ietf.org/rfc/rfc3987.txt
  3. http://www.w3.org/TR/rdfa-core/#s_curies

Synopsis

Documentation

data IRI Source #

Represents a general universal resource identifier using its component parts.

For example, for the (full) IRI

  foo://anonymous@www.haskell.org:42/ghc?query#frag

or the abbreviated IRI

  prefix:iriPath?iriQuery#iriFragment

or the simple IRI

 iriPath

Constructors

IRI 

Fields

Instances

Eq IRI Source # 

Methods

(==) :: IRI -> IRI -> Bool

(/=) :: IRI -> IRI -> Bool

Data IRI Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IRI -> c IRI

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IRI

toConstr :: IRI -> Constr

dataTypeOf :: IRI -> DataType

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c IRI)

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IRI)

gmapT :: (forall b. Data b => b -> b) -> IRI -> IRI

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IRI -> r

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IRI -> r

gmapQ :: (forall d. Data d => d -> u) -> IRI -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> IRI -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IRI -> m IRI

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IRI -> m IRI

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IRI -> m IRI

Ord IRI Source # 

Methods

compare :: IRI -> IRI -> Ordering

(<) :: IRI -> IRI -> Bool

(<=) :: IRI -> IRI -> Bool

(>) :: IRI -> IRI -> Bool

(>=) :: IRI -> IRI -> Bool

max :: IRI -> IRI -> IRI

min :: IRI -> IRI -> IRI

Show IRI Source # 

Methods

showsPrec :: Int -> IRI -> ShowS

show :: IRI -> String

showList :: [IRI] -> ShowS

GetRange IRI Source # 
SymbolName IRI Source # 

Methods

addString :: (IRI, String) -> IRI Source #

Pretty IRI Source # 

Methods

pretty :: IRI -> Doc Source #

pretties :: [IRI] -> Doc Source #

Function IRI Source # 

Methods

function :: Action -> AMap -> IRI -> IRI Source #

data IRIAuth Source #

Type for authority value within a IRI

Constructors

IRIAuth String String String 

Instances

Eq IRIAuth Source # 

Methods

(==) :: IRIAuth -> IRIAuth -> Bool

(/=) :: IRIAuth -> IRIAuth -> Bool

Data IRIAuth Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IRIAuth -> c IRIAuth

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IRIAuth

toConstr :: IRIAuth -> Constr

dataTypeOf :: IRIAuth -> DataType

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c IRIAuth)

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IRIAuth)

gmapT :: (forall b. Data b => b -> b) -> IRIAuth -> IRIAuth

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IRIAuth -> r

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IRIAuth -> r

gmapQ :: (forall d. Data d => d -> u) -> IRIAuth -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> IRIAuth -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IRIAuth -> m IRIAuth

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IRIAuth -> m IRIAuth

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IRIAuth -> m IRIAuth

Ord IRIAuth Source # 

Methods

compare :: IRIAuth -> IRIAuth -> Ordering

(<) :: IRIAuth -> IRIAuth -> Bool

(<=) :: IRIAuth -> IRIAuth -> Bool

(>) :: IRIAuth -> IRIAuth -> Bool

(>=) :: IRIAuth -> IRIAuth -> Bool

max :: IRIAuth -> IRIAuth -> IRIAuth

min :: IRIAuth -> IRIAuth -> IRIAuth

Show IRIAuth Source # 

Methods

showsPrec :: Int -> IRIAuth -> ShowS

show :: IRIAuth -> String

showList :: [IRIAuth] -> ShowS

nullIRI :: IRI Source #

Blank IRI

iriToStringUnsecure :: IRI -> String Source #

converts IRI to String of expanded form. if available. Also showing Auth

iriToStringShortUnsecure :: IRI -> String Source #

converts IRI to String of abbreviated form. if available. Also showing Auth info.

hasFullIRI :: IRI -> Bool Source #

check that we have a full (possibly expanded) IRI (i.e. for comparisons)

isSimple :: IRI -> Bool Source #

check that we have a simple IRI that is a (possibly expanded) abbreviated IRI without prefix

addSuffixToIRI :: String -> IRI -> IRI Source #

showTrace :: IRI -> String Source #

Parsing

iriParser :: IRIParser st IRI Source #

angles :: IRIParser st IRI -> IRIParser st IRI Source #

iriCurie :: IRIParser st IRI Source #

Parses an IRI reference enclosed in <, > or a CURIE

compoundIriCurie :: IRIParser st IRI Source #

parseCurie :: String -> Maybe IRI Source #

Turn a string containing a CURIE into an IRI

parseIRICurie :: String -> Maybe IRI Source #

Turn a string containing an IRI or a CURIE into an IRI. Returns Nothing if the string is not a valid IRI; (an absolute IRI enclosed in < and > with optional fragment identifier or a CURIE).

parseIRIReference :: String -> Maybe IRI Source #

Parse a IRI reference to an IRI value. Returns Nothing if the string is not a valid IRI reference. (an absolute or relative IRI with optional fragment identifier).

parseIRI :: String -> Maybe IRI Source #

Turn a string containing an RFC3987 IRI into an IRI. Returns Nothing if the string is not a valid IRI; (an absolute IRI with optional fragment identifier).

ncname :: GenParser Char st String Source #

Prefix part of CURIE in prefix_part:reference http://www.w3.org/TR/2009/REC-xml-names-20091208/#NT-NCName

expandCurie :: Map String IRI -> IRI -> Maybe IRI Source #

Expands a CURIE to an IRI. Nothing iff there is no IRI i assigned to the prefix of c or the concatenation of i and iriPath c is not a valid IRI.

relativeTo :: IRI -> IRI -> Maybe IRI Source #

Returns a new IRI which represents the value of the first IRI interpreted as relative to the second IRI. For example:

"foo" `relativeTo` "http://bar.org/" = "http://bar.org/foo"

relativeFrom :: IRI -> IRI -> IRI Source #

Returns a new IRI which represents the relative location of the first IRI with respect to the second IRI. Thus, the values supplied are expected to be absolute IRIs, and the result returned may be a relative IRI.

Example:

"http://example.com/Root/sub1/name2#frag"
  `relativeFrom` "http://example.com/Root/sub2/name2#frag"
  == "../sub1/name2#frag"

There is no single correct implementation of this function, but any acceptable implementation must satisfy the following:

(uabs `relativeFrom` ubase) `relativeTo` ubase == uabs

For any valid absolute IRI. (cf. http://lists.w3.org/Archives/Public/iri/2003Jan/0008.html http://lists.w3.org/Archives/Public/iri/2003Jan/0005.html)

Conversion

simpleIdToIRI :: SIMPLE_ID -> IRI Source #

Converts a Simple_ID to an IRI

setAngles :: Bool -> IRI -> IRI Source #

methods from OWL2.AS

isNullIRI :: IRI -> Bool Source #

check that we have a nullIRI

showIRI :: IRI -> String Source #

showIRICompact :: IRI -> String Source #

show IRI as abbreviated, when possible

showIRIFull :: IRI -> String Source #

show IRI in angle brackets as full IRI

dummyIRI :: IRI Source #

a default ontology name

mkIRI :: String -> IRI Source #

setPrefix :: String -> IRI -> IRI Source #

uriToCaslId :: IRI -> Id Source #

Extracts Id from URI