swish-0.9.2.1: A semantic web toolkit.

Copyright(c) 2003 Graham Klyne 2009 Vasili I Galchin
2011 2012 2014 Douglas Burke
LicenseGPL V2
MaintainerDouglas Burke
Stabilityexperimental
PortabilityCPP, OverloadedStrings
Safe HaskellNone
LanguageHaskell98

Swish.Namespace

Description

This module defines algebraic datatypes for namespaces and scoped names.

For these purposes, a namespace is a prefix and URI used to identify a namespace (cf. XML namespaces), and a scoped name is a name that is scoped by a specified namespace.

Synopsis

Documentation

data Namespace #

A NameSpace value consists of an optional prefix and a corresponding URI.

Instances
Eq Namespace #

Equality is defined by the URI, not by the prefix (so the same URI with different prefixes will be considered to be equal).

Instance details

Defined in Swish.Namespace

Ord Namespace # 
Instance details

Defined in Swish.Namespace

Show Namespace # 
Instance details

Defined in Swish.Namespace

makeNamespace #

Arguments

:: Maybe Text

optional prefix.

-> URI

URI.

-> Namespace 

Create a name space from a URI and an optional prefix label.

makeNamespaceQName #

Arguments

:: Namespace

The name space URI is used in the qualified name

-> LName

local component of the qualified name (can be emptyLName)

-> QName 

Create a qualified name by combining the URI from the name space with a local component.

getNamespacePrefix :: Namespace -> Maybe Text #

Returns the prefix stored in the name space.

getNamespaceURI :: Namespace -> URI #

Returns the URI stored in the name space.

getNamespaceTuple :: Namespace -> (Maybe Text, URI) #

Convert the name space to a (prefix, URI) tuple.

data ScopedName #

A full ScopedName value has a QName prefix, namespace URI and a local part. ScopedName values may omit the prefix (see Namespace) or the local part.

Some applications may handle null namespace URIs as meaning the local part is relative to some base URI.

Instances
Eq ScopedName #

Scoped names are equal if their corresponding QName values are equal.

Instance details

Defined in Swish.Namespace

Ord ScopedName #

Scoped names are ordered by their QName components.

Instance details

Defined in Swish.Namespace

Show ScopedName #

If there is a namespace associated then the Show instance uses prefix:local, otherwise url.

Instance details

Defined in Swish.Namespace

IsString ScopedName #

This is not total since it will fail if the input string is not a valid URI.

Instance details

Defined in Swish.Namespace

FromRDFLabel ScopedName #

Converts from a Resource.

Instance details

Defined in Swish.RDF.Graph

ToRDFLabel ScopedName #

Converts to a Resource.

Instance details

Defined in Swish.RDF.Graph

getScopeNamespace :: ScopedName -> Namespace #

Returns the namespace.

getScopeLocal :: ScopedName -> LName #

Returns the local part.

getScopePrefix :: ScopedName -> Maybe Text #

Returns the prefix of the namespace, if set.

getScopeURI :: ScopedName -> URI #

Returns the URI of the namespace.

getQName :: ScopedName -> QName #

Get the QName corresponding to a scoped name.

getScopedNameURI :: ScopedName -> URI #

Get URI corresponding to a scoped name (using RDF conventions).

matchName :: String -> ScopedName -> Bool #

Test if supplied string matches the display form of a scoped name.

makeScopedName #

Arguments

:: Maybe Text

prefix for the namespace

-> URI

namespace

-> LName

local name

-> ScopedName 

Construct a ScopedName.

makeQNameScopedName #

Arguments

:: Maybe Text

prefix

-> QName 
-> ScopedName 

Construct a ScopedName from a QName.

makeURIScopedName :: URI -> ScopedName #

Construct a ScopedName for a bare URI (the label is set to "").

makeNSScopedName #

Arguments

:: Namespace

namespace

-> LName

local component

-> ScopedName 

Construct a ScopedName.

nullScopedName :: ScopedName #

This should never appear as a valid name

namespaceToBuilder :: Namespace -> Builder #

Utility routine to create a @prefix line (matching N3/Turtle) grammar for this namespace.