swish-0.9.0.3: A semantic web toolkit.

PortabilityOverloadedStrings
Stabilityexperimental
MaintainerDouglas Burke
Safe HaskellNone

Swish.RDF.Vocabulary

Contents

Description

This module defines some commonly used vocabulary terms, using the Namespace and ScopedName data types. Additional vocabularies are available in the set of Swish.RDF.Vocabulary.* modules, parts of which are re-exported by this module

Synopsis

Namespaces

namespaceRDFD :: NamespaceSource

Maps rdfd to http://id.ninebynine.org/2003/rdfext/rdfd#.

namespaceXsdTypeSource

Arguments

:: LName

local name

-> Namespace

Namespace has prefix xsd_lbl and URI of http://id.ninebynine.org/2003/XMLSchema/lbl#.

Create a namespace for the datatype family schema used by Swish.

namespaceDefault :: NamespaceSource

Maps default to http://id.ninebynine.org/default/.

namespaceSwish :: NamespaceSource

Maps swish to http://id.ninebynine.org/2003/Swish/.

RDF rules

The namespaces refer to RDF rules and axioms.

scopeRDF :: NamespaceSource

Maps rs_rdf to http://id.ninebynine.org/2003/Ruleset/rdf#.

scopeRDFS :: NamespaceSource

Maps rs_rdfs to http://id.ninebynine.org/2003/Ruleset/rdfs#.

scopeRDFD :: NamespaceSource

Maps rs_rdfd to http://id.ninebynine.org/2003/Ruleset/rdfd#.

Language tags

Support for language tags that follow RFC 3066.

This replaces the use of ScopedName and langName, langTag, and isLang in versions prior to 0.7.0.0.

data LanguageTag Source

Represent the language tag for a literal string, following RFC 3066 http://www.ietf.org/rfc/rfc3066.txt.

Use toLangTag to create a tag and fromLangTag to convert back. The case is preserved for the tag, although comparison (both the Eq instance and compareLangTag) is done using the lower-case form of the tags.

As an example:

 Prelude> :set prompt "swish> "
 swish> :set -XOverloadedStrings
 swish> :m + Swish.RDF.Vocabulary
 swish> let en = "en" :: LanguageTag
 swish> let us = "en-us" :: LanguageTag
 swish> let gb = "en-GB" :: LanguageTag
 swish> gb
 en-GB
 swish> gb == "en-gb"
 True
 swish> en == us
 False
 swish> en `isBaseLang` us
 True
 swish> us `isBaseLang` en
 False
 swish> us `isBaseLang` gb
 False

Instances

Eq LanguageTag

The equality test matches on the full definition, so en-GB does not match en. See also isBaseLang.

Ord LanguageTag 
Show LanguageTag 
IsString LanguageTag

The IsString instance is not total since it will fail given a syntactically-invalid language tag.

toLangTag :: Text -> Maybe LanguageTagSource

Create a LanguageTag element from the label.

Valid tags follow the ABNF from RCF 3066, which is

   Language-Tag = Primary-subtag *( "-" Subtag )
   Primary-subtag = 1*8ALPHA
   Subtag = 1*8(ALPHA / DIGIT)

There are no checks that the primary or secondary sub tag values are defined in any standard, such as ISO 639, or obey any other syntactical restriction than given above.

fromLangTag :: LanguageTag -> TextSource

Convert a language tag back into text form.

isBaseLangSource

Arguments

:: LanguageTag

base language

-> LanguageTag

comparison language

-> Bool 

Compare language tags using the Language-range specification in section 2.5 of RFC 3066.

True is returned if the comparison tag is the same as, or matches a prefix of, the base tag (where the match must be over complete sub tags).

Note that

 l1 `isBaseLang` l2 == l2 `isBaseLang` l1

only when

 l1 == l2

Miscellaneous routines

swishName :: LName -> ScopedNameSource

Convert a local name to a scoped name in the swish namespace (namespaceSwish).

rdfdGeneralRestriction :: ScopedNameSource

rdfd:GeneralRestriction.

rdfdOnProperties :: ScopedNameSource

rdfd:onProperties.

rdfdConstraint :: ScopedNameSource

rdfd:constraint.

rdfdMaxCardinality :: ScopedNameSource

rdfd:maxCardinality.

defaultBase :: ScopedNameSource

default:base.

Re-exported modules