Copyright | (c) 2003 Graham Klyne 2009 Vasili I Galchin 2011 2014 2021 2022 Douglas Burke |
---|---|
License | GPL V2 |
Maintainer | Douglas Burke |
Stability | experimental |
Portability | CPP, OverloadedStrings |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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#
.
:: LName | local name |
-> Namespace | Namespace has prefix |
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.
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
IsString LanguageTag Source # | The |
Defined in Swish.RDF.Vocabulary fromString :: String -> LanguageTag # | |
Show LanguageTag Source # | |
Defined in Swish.RDF.Vocabulary showsPrec :: Int -> LanguageTag -> ShowS # show :: LanguageTag -> String # showList :: [LanguageTag] -> ShowS # | |
Eq LanguageTag Source # | The equality test matches on the full definition, so
|
Defined in Swish.RDF.Vocabulary (==) :: LanguageTag -> LanguageTag -> Bool # (/=) :: LanguageTag -> LanguageTag -> Bool # | |
Ord LanguageTag Source # | |
Defined in Swish.RDF.Vocabulary compare :: LanguageTag -> LanguageTag -> Ordering # (<) :: LanguageTag -> LanguageTag -> Bool # (<=) :: LanguageTag -> LanguageTag -> Bool # (>) :: LanguageTag -> LanguageTag -> Bool # (>=) :: LanguageTag -> LanguageTag -> Bool # max :: LanguageTag -> LanguageTag -> LanguageTag # min :: LanguageTag -> LanguageTag -> LanguageTag # |
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.
:: 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