swish-0.10.0.2: A semantic web toolkit.

Copyright | (c) 2003 Graham Klyne 2009 Vasili I Galchin 2011 2014 Douglas Burke
License | GPL V2
Maintainer | Douglas Burke
Stability | experimental
Portability | CPP, OverloadedStrings
Safe Haskell | None
Language | Haskell98

Swish.RDF.Vocabulary

Contents

- Namespaces
  - RDF rules
- Language tags
- Miscellaneous routines
- Re-exported modules

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

- namespaceRDFD :: Namespace
- namespaceXsdType :: LName -> Namespace
- namespaceMATH :: Namespace
- namespaceLOG :: Namespace
- namespaceDAML :: Namespace
- namespaceDefault :: Namespace
- namespaceSwish :: Namespace
- scopeRDF :: Namespace
- scopeRDFS :: Namespace
- scopeRDFD :: Namespace
- data LanguageTag
- toLangTag :: Text -> Maybe LanguageTag
- fromLangTag :: LanguageTag -> Text
- isBaseLang :: LanguageTag -> LanguageTag -> Bool
- swishName :: LName -> ScopedName
- rdfdGeneralRestriction :: ScopedName
- rdfdOnProperties :: ScopedName
- rdfdConstraint :: ScopedName
- rdfdMaxCardinality :: ScopedName
- logImplies :: ScopedName
- defaultBase :: ScopedName
- module Swish.RDF.Vocabulary.RDF
- module Swish.RDF.Vocabulary.OWL
- module Swish.RDF.Vocabulary.XSD

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

namespaceMATH :: Namespace Source #

Maps `math` to http://www.w3.org/2000/10/swap/math#.

namespaceLOG :: Namespace Source #

Maps `log` to http://www.w3.org/2000/10/swap/log#.

namespaceDAML :: Namespace Source #

Maps `daml` to http://www.daml.org/2000/10/daml-ont#.

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 Methods (==) :: LanguageTag -> LanguageTag -> Bool Source # (/=) :: LanguageTag -> LanguageTag -> Bool Source #
Ord LanguageTag Source # |

Instance details

Defined in Swish.RDF.Vocabulary

Methods

compare :: LanguageTag -> LanguageTag -> Ordering Source #

(<) :: LanguageTag -> LanguageTag -> Bool Source #

(<=) :: LanguageTag -> LanguageTag -> Bool Source #

(>) :: LanguageTag -> LanguageTag -> Bool Source #

(>=) :: LanguageTag -> LanguageTag -> Bool Source #

max :: LanguageTag -> LanguageTag -> LanguageTag Source #

min :: LanguageTag -> LanguageTag -> LanguageTag Source #

Show LanguageTag Source # |
Instance details Defined in Swish.RDF.Vocabulary Methods showsPrec :: Int -> LanguageTag -> ShowS Source # show :: LanguageTag -> String Source # showList :: [LanguageTag] -> ShowS Source #
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 Methods fromString :: String -> LanguageTag Source #

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

module Swish.RDF.Vocabulary.RDF

module Swish.RDF.Vocabulary.OWL

module Swish.RDF.Vocabulary.XSD