Module

Perspectives.Identifiers

#modelRegex

modelRegex :: Regex

A Namespace has the form "model:Name"

#isModelName

#buitenRol

#deconstructBuitenRol

deconstructBuitenRol :: String -> String

Returns the identifier minus the "External" or "$buitenRol" part.

#Namespace

#LocalName

#Prefix

type Prefix = String

#PEIdentifier

#ModelName

newtype ModelName

Only a psp:Context can have a ModelName. In other words, if something has a ModelName, its pspType is psp:Context. However, a psp:Context may have a QualifiedName!

Constructors

Instances

#QualifiedName

data QualifiedName

A QualifiedName consists of a namespace and a local name.

Constructors

Instances

#PerspectEntiteitIdentifier

class PerspectEntiteitIdentifier a  where

Abstracts over identifiers for Perspect, used in the CRL parser. There are two instances: ModelName and QualifiedName.

Members

Instances

#guardWellFormedNess

#domeinURIQualifiedRegex

domeinURIQualifiedRegex :: Regex

A qualified name has the form model:ModelName$First$Second. In other words, it consists of

  • a modelName: model:ModelName, followed by any number of
  • segments: $segment (a '$' followed by word characters). Alternatively, we can split a qualifiedName in
  • a namespace: everything but the last segment, and
  • the localName: the last segment.

#isQualifiedWithDomein

isQualifiedWithDomein :: String -> Boolean

Is the identifier qualified with a valid Namespace?

#namespaceRegEx

namespaceRegEx :: Regex

Matches the entire namespace part of a qualified name (everything but the last segment).

#deconstructNamespace

deconstructNamespace :: String -> Maybe Namespace

Returns the entire name but for the last segment. This is the namespace of the local name. deconstructNamespace "model:Model$First$Second" == Just "model:Model$First" deconstructNamespace "model:Model" == Just "model:Model"

#deconstructNamespace_

deconstructNamespace_ :: String -> Namespace

As deconstructNamespace, but will throw a runtime error if it fails.

#namespaceRegex

#deconstructModelName

deconstructModelName :: String -> Maybe Namespace

Returns the "model:ModelName" part of an identifier or Nothing if it does not start with model:ModelName. deconstructModelName "model:Model$First$Second" == Just "model:Model" deconstructModelName "model:Model" == Just "model:Model"

#localPartsRegEx

localPartsRegEx :: Regex

Matches the last segment of the name (the word after the last "$")

#deconstructSegments

deconstructSegments :: String -> Maybe String

Returns "Context$localName" from "model:ModelName$Context$localName" or Nothing if it does not start with model:ModelName So this function returns ALL SEGMENTS of the name, omitting just the model:ModelName part. deconstructSegments "model:ModelName$Context$localName" == Just "Context$localName" deconstructSegments "model:Model" == Just ""

#lastPartRegEx

#deconstructLocalName

deconstructLocalName :: String -> Maybe String

Returns "localName" from "model:ModelName$Context$localName" or Nothing So this function returns THE LAST SEGMENT of the name. deconstructLocalName "model:Model$First$Second" == Just "Second" deconstructLocalName "model:Model" == Nothing

#deconstructLocalName_

#hasLocalName

hasLocalName :: String -> String -> Boolean

"model:Perspectives$Context" hasLocalName "Context"

#isLocalNameOf

isLocalNameOf :: String -> String -> Boolean

"Context" isLocalNameOf "model:Perspectives$Context"

#curieRegEx

#deconstructPrefix

deconstructPrefix :: String -> Maybe Prefix

Returns 'pre' from 'pre:someurl' or Nothing.

#deconstructLocalNameFromCurie

deconstructLocalNameFromCurie :: String -> Maybe String

Returns "someurl" from "pre:someurl" or Nothing

#userCurieRegEx

#isUserCurie

isUserCurie :: String -> Boolean

True iff the string starts on "usr:"

#userUriRegEx

#isUserURI

isUserURI :: String -> Boolean

True iff the string starts on "model:User$"

#isUserEntiteitID

#roleIndexNrRegex

#roleIndexNr

roleIndexNr :: String -> Maybe String

Role names are postfixed with an index to distinghuish between multiple occurrences of the same role type.

#escapeCouchdbDocumentName

#isInNamespace

isInNamespace :: String -> String -> Boolean

To be used for qualified names only! True iff the first argument contains the second (as its first part). E.g.: "model:Perspectives$Aangifte$Aangever" isInNamespace "model:Perspectives$Aangifte". "a" isInNamespace "a" is true, too.

#isContainingNamespace

isContainingNamespace :: String -> String -> Boolean

To be used for qualified names only! True iff the first argument is the first part of the second. E.g.: "model:Perspectives$Aangifte" isContainingNamespace "model:Perspectives$Aangifte$Aangever". Hence, a SubNamespace is more specialized, thus longer.

#endsWithSegments

endsWithSegments :: String -> String -> Boolean

True iff the second argument is a suffix of the first argument. Does not check whether names are well-formed qualified names. whole endsWithSegments part "model:Model$First$Second$Third" endsWithSegments "Second$Third" == true "model:Model$First$Second$Third" endsWithSegments "Second" == false

#areLastSegmentsOf

areLastSegmentsOf :: String -> String -> Boolean

"Second$Third" areLastSegmentsOf "model:Model$First$Second$Third" == true "Second" areLastSegmentsOf "model:Model$First$Second$Third" == false

#getFirstMatch

#getSecondMatch

#expandDefaultNamespaces

expandDefaultNamespaces :: String -> String

Expand:

  • psp: to model:Perspectives$,
  • q: to model:QueryAst$,
  • u: to model:User$.

#q

#psp

Modules