swish-0.10.0.2: A semantic web toolkit.

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

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 :: Namespace Source #

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

namespaceXsdType Source #

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 :: Namespace Source #

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

namespaceSwish :: Namespace Source #

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

RDF rules

The namespaces refer to RDF rules and axioms.

scopeRDF :: Namespace Source #

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

scopeRDFS :: Namespace Source #

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

scopeRDFD :: Namespace Source #

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 Source #

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

Instance details

Defined in Swish.RDF.Vocabulary

Ord LanguageTag Source # 
Instance details

Defined in Swish.RDF.Vocabulary

Show LanguageTag Source # 
Instance details

Defined in Swish.RDF.Vocabulary

IsString LanguageTag Source #

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

Instance details

Defined in Swish.RDF.Vocabulary

toLangTag :: Text -> Maybe LanguageTag Source #

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 -> Text Source #

Convert a language tag back into text form.

isBaseLang Source #

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 -> ScopedName Source #

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

rdfdGeneralRestriction :: ScopedName Source #

rdfd:GeneralRestriction.

rdfdOnProperties :: ScopedName Source #

rdfd:onProperties.

rdfdConstraint :: ScopedName Source #

rdfd:constraint.

rdfdMaxCardinality :: ScopedName Source #

rdfd:maxCardinality.

logImplies :: ScopedName Source #

log:implies.

defaultBase :: ScopedName Source #

default:base.

Re-exported modules