{-# LANGUAGE OverloadedStrings #-}

--------------------------------------------------------------------------------
--  See end of this file for licence information.
--------------------------------------------------------------------------------
-- |
--  Module      :  Swish.RDF.Vocabulary.Geo
--  Copyright   :  (c) 2011 Douglas Burke
--  License     :  GPL V2
--
--  Maintainer  :  Douglas Burke
--  Stability   :  experimental
--  Portability :  OverloadedStrings
--
--  This module defines some commonly used vocabulary terms from the Geo
--  vocabulary (<http://www.w3.org/2003/01/geo/>, WGS84 Geo Positioning: an RDF vocabulary).
--
--  Note that unlike some of the existing vocabularies in Swish, the Geo
--  one matches the case and spelling of the RDF terms; so we
--  use 'geolat' rather than @geoLat@.
--
--------------------------------------------------------------------------------

module Swish.RDF.Vocabulary.Geo
    ( 
      namespaceGEO
      -- * Classes
      , geoSpatialThing
      , geoPoint
      -- * Properties
      , geolocation
      , geolat
      , geolong
      , geolat_long
    )
where

import Swish.Namespace (Namespace, ScopedName, makeNamespace, makeNSScopedName)
import Swish.QName (LName)

import Data.Maybe (fromMaybe)
import Network.URI (URI, parseURI)

------------------------------------------------------------
--  Namespace
------------------------------------------------------------

geoURI :: URI
geoURI :: URI
geoURI = forall a. a -> Maybe a -> a
fromMaybe (forall a. HasCallStack => [Char] -> a
error [Char]
"Internal error processing Geo URI") forall a b. (a -> b) -> a -> b
$ [Char] -> Maybe URI
parseURI [Char]
"http://www.w3.org/2003/01/geo/wgs84_pos#"

-- | Maps @geo@ to <http://www.w3.org/2003/01/geo/wgs84_pos#>.
namespaceGEO :: Namespace
namespaceGEO :: Namespace
namespaceGEO = Maybe Text -> URI -> Namespace
makeNamespace (forall a. a -> Maybe a
Just Text
"geo") URI
geoURI

------------------------------------------------------------
--  Terms
------------------------------------------------------------

toG :: LName -> ScopedName
toG :: LName -> ScopedName
toG  = Namespace -> LName -> ScopedName
makeNSScopedName Namespace
namespaceGEO

-- | @geo:location@.
geolocation :: ScopedName
geolocation :: ScopedName
geolocation = LName -> ScopedName
toG LName
"location"

-- | @geo:lat@.
geolat :: ScopedName
geolat :: ScopedName
geolat = LName -> ScopedName
toG LName
"lat"

-- | @geo:long@.
geolong :: ScopedName
geolong :: ScopedName
geolong = LName -> ScopedName
toG LName
"long"

-- | @geo:lat_long@ (it is suggested that this not be used when generating RDF statements).
geolat_long :: ScopedName
geolat_long :: ScopedName
geolat_long = LName -> ScopedName
toG LName
"lat_long"

-- | @geo:SpatialThing@.
geoSpatialThing :: ScopedName
geoSpatialThing :: ScopedName
geoSpatialThing = LName -> ScopedName
toG LName
"SpatialThing"

-- | @geo:Point@.
geoPoint :: ScopedName
geoPoint :: ScopedName
geoPoint = LName -> ScopedName
toG LName
"Point"

--------------------------------------------------------------------------------
--
--  Copyright (c) 2011 Douglas Burke
--  All rights reserved.
--
--  This file is part of Swish.
--
--  Swish is free software; you can redistribute it and/or modify
--  it under the terms of the GNU General Public License as published by
--  the Free Software Foundation; either version 2 of the License, or
--  (at your option) any later version.
--
--  Swish is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with Swish; if not, write to:
--    The Free Software Foundation, Inc.,
--    59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
--
--------------------------------------------------------------------------------