packages feed

swish 0.6.3.0 → 0.6.4.0

raw patch · 10 files changed

+859/−11 lines, 10 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Swish.RDF.MapXsdDecimal: mapXsdDecimal :: DatatypeMap Double
+ Swish.RDF.RDFDatatypeXsdDecimal: axiomsXsdDecimal :: [RDFFormula]
+ Swish.RDF.RDFDatatypeXsdDecimal: namespaceXsdDecimal :: Namespace
+ Swish.RDF.RDFDatatypeXsdDecimal: prefixXsdDecimal :: Builder
+ Swish.RDF.RDFDatatypeXsdDecimal: rdfDatatypeValXsdDecimal :: RDFDatatypeVal Double
+ Swish.RDF.RDFDatatypeXsdDecimal: rdfDatatypeXsdDecimal :: RDFDatatype
+ Swish.RDF.RDFDatatypeXsdDecimal: rulesXsdDecimal :: [RDFRule]
+ Swish.RDF.RDFDatatypeXsdDecimal: typeNameXsdDecimal :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: namespacePROV :: Namespace
+ Swish.RDF.Vocabulary.Provenance: provActivity :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provAgent :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provControl :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provEntity :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provGeneration :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provLocation :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provParticipation :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provProvenanceContainer :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provQualifiedInvolvement :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provRecipe :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provRole :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provUsage :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provdependedOn :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provendedAt :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadLocation :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadOriginalSource :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadParticipant :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadQualifiedControl :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadQualifiedEntity :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadQualifiedGeneration :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadQualifiedParticipation :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadQualifiedUsage :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadRecipe :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadRole :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provhadTemporalValue :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provstartedAt :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provused :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasAttributedTo :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasComplementOf :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasControlledBy :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasDerivedFrom :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasEventuallyDerivedFrom :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasGeneratedAt :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasGeneratedBy :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasInformedBy :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasQuoteOf :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasRevisionOf :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasScheduledAfter :: ScopedName
+ Swish.RDF.Vocabulary.Provenance: provwasSummaryOf :: ScopedName

Files

README view
@@ -1,6 +1,5 @@ This is an update to Swish [1,2] so that it builds with a recent-Haskell platform (although it has not been tested against ghc-7 and-the 2011.2.0.0 Haskell Platform releases).+Haskell platform.  For more information on this release see [3]. 
src/Swish/RDF/BuiltInDatatypes.hs view
@@ -25,6 +25,7 @@ import Swish.Utils.Namespace (ScopedName) import Swish.RDF.RDFDatatypeXsdString (rdfDatatypeXsdString) import Swish.RDF.RDFDatatypeXsdInteger (rdfDatatypeXsdInteger)+import Swish.RDF.RDFDatatypeXsdDecimal (rdfDatatypeXsdDecimal)  ------------------------------------------------------------ --  Declare datatype map@@ -34,6 +35,7 @@ allDatatypes =     [ rdfDatatypeXsdString     , rdfDatatypeXsdInteger+    , rdfDatatypeXsdDecimal     ]  findRDFDatatype :: ScopedName -> Maybe RDFDatatype
src/Swish/RDF/ClassRestrictionRule.hs view
@@ -516,8 +516,8 @@ ------------------------------------------------------------  makeRDFDatatypeRestrictionRules :: RDFDatatypeVal vt -> RDFGraph -> [RDFRule]-makeRDFDatatypeRestrictionRules dtval gr =-    makeRDFClassRestrictionRules dcrs gr+makeRDFDatatypeRestrictionRules dtval =+    makeRDFClassRestrictionRules dcrs      where         dcrs = map (makeDatatypeRestriction dtval) (tvalRel dtval) 
src/Swish/RDF/GraphMatch.hs view
@@ -561,8 +561,8 @@   => LabelMap lb -- ^ the current label index values   -> [Arc lb] -- ^ calculate signatures for these arcs   -> [Int] -- ^ the signatures of the arcs-arcSignatures lmap gs =-    map (sigCalc . arcToTriple) gs+arcSignatures lmap =+    map (sigCalc . arcToTriple)      where         sigCalc (s,p,o)  =             ( labelVal2 s +
+ src/Swish/RDF/MapXsdDecimal.hs view
@@ -0,0 +1,72 @@+{-# LANGUAGE OverloadedStrings #-}++--------------------------------------------------------------------------------+--  See end of this file for licence information.+--------------------------------------------------------------------------------+-- |+--  Module      :  MapXsdDecimal+--  Copyright   :  (c) 2003, Graham Klyne, 2009 Vasili I Galchin,+--                     2011 Douglas Burke, 2011 William Waites+--  License     :  GPL V2+--+--  Maintainer  :  Douglas Burke+--  Stability   :  experimental+--  Portability :  OverloadedStrings+--+--  This module defines the datatytpe mapping and relation values+--  used for RDF dataype xsd:decimal+--+--------------------------------------------------------------------------------++module Swish.RDF.MapXsdDecimal (mapXsdDecimal) where++import Swish.RDF.Datatype (DatatypeMap(..))++import qualified Data.Text as T+import qualified Data.Text.Read as T++------------------------------------------------------------+--  Implementation of DatatypeMap for xsd:decimal+------------------------------------------------------------++-- |mapXsdDecimal contains functions that perform lexical-to-value+--  and value-to-canonical-lexical mappings for xsd:decimal values+--+mapXsdDecimal :: DatatypeMap Double+mapXsdDecimal = DatatypeMap+    { -- mapL2V :: T.Text -> Maybe Double+      mapL2V = \txt -> case T.double txt of+      	 Right (val, "") -> Just val+         _ -> Nothing+         +      -- mapV2L :: Double -> Maybe T.Text+      -- TODO: for now convert via String as issues with text-format+      --       (inability to use with ghci)   +    , mapV2L = Just . T.pack . show+    }++--------------------------------------------------------------------------------+--+--  Copyright (c) 2003, Graham Klyne, 2009 Vasili I Galchin,+--                2011 Douglas Burke, 2011 William Waites+--+--  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+--+--------------------------------------------------------------------------------
src/Swish/RDF/NTFormatter.hs view
@@ -211,7 +211,7 @@ -- we assume c > 0, n >= 0 and that the input value fits -- into the requested number of digits numToHex :: Int -> Int -> String-numToHex c v = go [] v+numToHex c = go []   where     go s 0 = replicate (c - length s) '0' ++ s     go s n = 
+ src/Swish/RDF/RDFDatatypeXsdDecimal.hs view
@@ -0,0 +1,487 @@+{-# LANGUAGE OverloadedStrings #-}++--------------------------------------------------------------------------------+--  See end of this file for licence information.+--------------------------------------------------------------------------------+-- |+--  Module      :  RDFDatatypeXsdDecimal+--  Copyright   :  (c) 2003, Graham Klyne, 2009 Vasili I Galchin,+--                     2011 Douglas Burke+--  License     :  GPL V2+--+--  Maintainer  :  Douglas Burke+--  Stability   :  experimental+--  Portability :  OverloadedStrings+--+--  This module defines the structures used by Swish to represent and+--  manipulate RDF @xsd:double@ datatyped literals.+--+--------------------------------------------------------------------------------++module Swish.RDF.RDFDatatypeXsdDecimal+    ( rdfDatatypeXsdDecimal+    , rdfDatatypeValXsdDecimal+    , typeNameXsdDecimal, namespaceXsdDecimal+    , axiomsXsdDecimal, rulesXsdDecimal+    , prefixXsdDecimal+    )+where++import Swish.RDF.RDFRuleset+    ( RDFFormula, RDFRule, RDFRuleset +    , makeRDFGraphFromN3Builder+    , makeRDFFormula+    )++import Swish.RDF.RDFDatatype+    ( RDFDatatype+    , RDFDatatypeVal+    , RDFDatatypeMod+    , makeRdfDtOpenVarBindingModifiers+    )++import Swish.RDF.ClassRestrictionRule (makeRDFDatatypeRestrictionRules)+import Swish.RDF.MapXsdDecimal (mapXsdDecimal)++import Swish.RDF.Datatype+    ( Datatype(..)+    , DatatypeVal(..)+    , DatatypeRel(..), DatatypeRelPr+    , altArgs+    , UnaryFnTable,    unaryFnApp+    , BinaryFnTable,   binaryFnApp+    , DatatypeMod(..) +    , makeVmod11inv, makeVmod11+    , makeVmod21inv, makeVmod21+    , makeVmod20+    )++import Swish.RDF.Ruleset (makeRuleset)++import Swish.Utils.Namespace (Namespace, ScopedName, namespaceToBuilder, makeNSScopedName)++import Swish.RDF.Vocabulary+    ( namespaceRDF+    , namespaceRDFS+    , namespaceRDFD+    , namespaceXSD+    , namespaceXsdType+    )++import Data.Monoid(Monoid(..))++import qualified Data.Text as T+import qualified Data.Text.Lazy.Builder as B++------------------------------------------------------------+--  Misc values+------------------------------------------------------------++--  Local name for Double datatype+nameXsdDecimal :: T.Text+nameXsdDecimal      = "decimal"++-- |Type name for xsd:double datatype+typeNameXsdDecimal :: ScopedName+typeNameXsdDecimal  = makeNSScopedName namespaceXSD nameXsdDecimal++-- |Namespace for xsd:double datatype functions+namespaceXsdDecimal :: Namespace+namespaceXsdDecimal = namespaceXsdType nameXsdDecimal++------------------------------------------------------------+--  Declare exported RDFDatatype value for xsd:double+------------------------------------------------------------++rdfDatatypeXsdDecimal :: RDFDatatype+rdfDatatypeXsdDecimal = Datatype rdfDatatypeValXsdDecimal++------------------------------------------------------------+--  Implmentation of RDFDatatypeVal for xsd:double+------------------------------------------------------------++-- |Define Datatype value for @xsd:double@.+--+--  Members of this datatype decimal values.+--+--  The lexical form consists of an optional @+@ or @-@+--  followed by a sequence of decimal digits.+--+--  The canonical lexical form has leading zeros and @+@ sign removed.+--+rdfDatatypeValXsdDecimal :: RDFDatatypeVal Double+rdfDatatypeValXsdDecimal = DatatypeVal+    { tvalName      = typeNameXsdDecimal+    , tvalRules     = rdfRulesetXsdDecimal  -- Ruleset RDFGraph+    , tvalMkRules   = makeRDFDatatypeRestrictionRules rdfDatatypeValXsdDecimal+                                            -- RDFGraph -> [RDFRules]+    , tvalMkMods    = makeRdfDtOpenVarBindingModifiers rdfDatatypeValXsdDecimal+    , tvalMap       = mapXsdDecimal         -- DatatypeMap Double+    , tvalRel       = relXsdDecimal         -- [DatatypeRel Double]+    , tvalMod       = modXsdDecimal         -- [DatatypeMod Double]+    }++-- |relXsdDecimal contains arithmetic and other relations for xsd:double values.+--+--  The functions are inspired by those defined by CWM as math: properties+--  (<http://www.w3.org/2000/10/swap/doc/CwmBuiltins.html>).+--+relXsdDecimal :: [DatatypeRel Double]+relXsdDecimal =+    [ relXsdDecimalAbs+    , relXsdDecimalNeg+    , relXsdDecimalSum+    , relXsdDecimalDiff+    , relXsdDecimalProd+    , relXsdDecimalPower+    , relXsdDecimalEq+    , relXsdDecimalNe+    , relXsdDecimalLt+    , relXsdDecimalLe+    , relXsdDecimalGt+    , relXsdDecimalGe+    ]++mkDecRel2 ::+    T.Text -> DatatypeRelPr Double -> UnaryFnTable Double+    -> DatatypeRel Double+mkDecRel2 nam pr fns = DatatypeRel+    { dtRelName = makeNSScopedName namespaceXsdDecimal nam+    , dtRelFunc = altArgs pr fns unaryFnApp+    }++mkDecRel3 ::+    T.Text -> DatatypeRelPr Double -> BinaryFnTable Double+    -> DatatypeRel Double+mkDecRel3 nam pr fns = DatatypeRel+    { dtRelName = makeNSScopedName namespaceXsdDecimal nam+    , dtRelFunc = altArgs pr fns binaryFnApp+    }++relXsdDecimalAbs :: DatatypeRel Double+relXsdDecimalAbs = mkDecRel2 "abs" (const True)+    [ ( (>=0),      [ (abs,1) ] )+    , ( const True, [ (id,0), (negate,0) ] )+    ]++relXsdDecimalNeg :: DatatypeRel Double+relXsdDecimalNeg = mkDecRel2 "neg" (const True)+    [ ( const True, [ (negate,1) ] )+    , ( const True, [ (negate,0) ] )+    ]++relXsdDecimalSum :: DatatypeRel Double+relXsdDecimalSum = mkDecRel3 "sum" (const True)+    [ ( const True, [ ((+),1,2) ] )+    , ( const True, [ ((-),0,2) ] )+    , ( const True, [ ((-),0,1) ] )+    ]++relXsdDecimalDiff :: DatatypeRel Double+relXsdDecimalDiff = mkDecRel3 "diff" (const True)+    [ ( const True, [ ((-),1,2) ] )+    , ( const True, [ ((+),0,2) ] )+    , ( const True, [ ((-),1,0) ] )+    ]++relXsdDecimalProd :: DatatypeRel Double+relXsdDecimalProd = mkDecRel3 "prod" (const True)+    [ ( const True, [ ((*),1,2) ] )+    , ( const True, [ ((/),0,2) ] )+    , ( const True, [ ((/),0,1) ] )+    ]++relXsdDecimalPower :: DatatypeRel Double+relXsdDecimalPower = mkDecRel3 "power" (const True)+    [ ( const True, [ ((**),1,2) ] )+    , ( const True, [ ] )+    , ( (>=0),      [ ] )+    ]++liftL2 :: (a->a->Bool) -> ([a]->a) -> ([a]->a) -> [a] -> Bool+liftL2 p i1 i2 as = p (i1 as) (i2 as)++lcomp :: (a->a->Bool) -> [a] -> Bool+lcomp p = liftL2 p head (head . tail)++-- eq++relXsdDecimalEq :: DatatypeRel Double+relXsdDecimalEq = mkDecRel2 "eq" (lcomp (==))+    ( repeat (const True, []) )++-- ne++relXsdDecimalNe :: DatatypeRel Double+relXsdDecimalNe = mkDecRel2 "ne" (lcomp (/=))+    ( repeat (const True, []) )++-- lt++relXsdDecimalLt :: DatatypeRel Double+relXsdDecimalLt = mkDecRel2 "lt" (lcomp (<))+    ( repeat (const True, []) )++-- le++relXsdDecimalLe :: DatatypeRel Double+relXsdDecimalLe = mkDecRel2 "le" (lcomp (<=))+    ( repeat (const True, []) )++-- gt++relXsdDecimalGt :: DatatypeRel Double+relXsdDecimalGt = mkDecRel2 "gt" (lcomp (>))+    ( repeat (const True, []) )++-- ge++relXsdDecimalGe :: DatatypeRel Double+relXsdDecimalGe = mkDecRel2 "ge" (lcomp (>=))+    ( repeat (const True, []) )++-- |modXsdDecimal contains variable binding modifiers for xsd:double values.+--+--  The functions are selected from those defined by CWM as math:+--  properties+--  (<http://www.w3.org/2000/10/swap/doc/CwmBuiltins.html>).+--+modXsdDecimal :: [RDFDatatypeMod Double]+modXsdDecimal =+    [ modXsdDecimalAbs+    , modXsdDecimalNeg+    , modXsdDecimalSum+    , modXsdDecimalDiff+    , modXsdDecimalProd+    , modXsdDecimalPower+    , modXsdDecimalEq+    , modXsdDecimalNe+    , modXsdDecimalLt+    , modXsdDecimalLe+    , modXsdDecimalGt+    , modXsdDecimalGe+    ]++modXsdDecimalAbs :: RDFDatatypeMod Double+modXsdDecimalAbs = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "abs"+    , dmModf = [ f0, f1 ]+    , dmAppf = makeVmod11+    }+    where+        f0 vs@[v1,v2] = if v1 == abs v2 then vs else []+        f0 _          = []+        f1 [v2]       = [abs v2]+        f1 _          = []++modXsdDecimalNeg :: RDFDatatypeMod Double+modXsdDecimalNeg = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "neg"+    , dmModf = [ f0, f1, f1 ]+    , dmAppf = makeVmod11inv+    }+    where+        f0 vs@[v1,v2] = if v1 == negate v2 then vs else []+        f0 _          = []+        f1 [vi]       = [-vi]+        f1 _          = []++modXsdDecimalSum :: RDFDatatypeMod Double+modXsdDecimalSum = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "sum"+    , dmModf = [ f0, f1, f2, f2 ]+    , dmAppf = makeVmod21inv+    }+    where+        f0 vs@[v1,v2,v3] = if v1 == v2+v3 then vs else []+        f0 _             = []+        f1 [v2,v3]       = [v2+v3]+        f1 _             = []+        f2 [v1,vi]       = [v1-vi]+        f2 _             = []++modXsdDecimalDiff :: RDFDatatypeMod Double+modXsdDecimalDiff = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "diff"+    , dmModf = [ f0, f1, f2, f3 ]+    , dmAppf = makeVmod21inv+    }+    where+        f0 vs@[v1,v2,v3] = if v1 == v2-v3 then vs else []+        f0 _             = []+        f1 [v2,v3]       = [v2-v3]+        f1 _             = []+        f2 [v1,v3]       = [v1+v3]+        f2 _             = []+        f3 [v1,v2]       = [v2-v1]+        f3 _             = []++modXsdDecimalProd :: RDFDatatypeMod Double+modXsdDecimalProd = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "prod"+    , dmModf = [ f0, f1, f2, f2 ]+    , dmAppf = makeVmod21inv+    }+    where+        f0 vs@[v1,v2,v3] = if v1 == v2*v3 then vs else []+        f0 _             = []+        f1 [v2,v3]       = [v2*v3]+        f1 _             = []+        f2 [v1,vi]       = [v1/vi]+        f2 _             = []++modXsdDecimalPower :: RDFDatatypeMod Double+modXsdDecimalPower = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal "power"+    , dmModf = [ f0, f1 ]+    , dmAppf = makeVmod21+    }+    where+        f0 vs@[v1,v2,v3] = if v1 == (v2**v3 :: Double) then vs else []+        f0 _             = []+        f1 [v2,v3]       = [v2**v3 :: Double]+        f1 _             = []++modXsdDecimalEq, modXsdDecimalNe, modXsdDecimalLt, modXsdDecimalLe, modXsdDecimalGt, modXsdDecimalGe :: RDFDatatypeMod Double +modXsdDecimalEq = modXsdDecimalCompare "eq" (==)+modXsdDecimalNe = modXsdDecimalCompare "ne" (/=)+modXsdDecimalLt = modXsdDecimalCompare "lt" (<)+modXsdDecimalLe = modXsdDecimalCompare "le" (<=)+modXsdDecimalGt = modXsdDecimalCompare "gt" (>)+modXsdDecimalGe = modXsdDecimalCompare "ge" (>=)++modXsdDecimalCompare ::+    T.Text -> (Double->Double->Bool) -> RDFDatatypeMod Double+modXsdDecimalCompare nam rel = DatatypeMod+    { dmName = makeNSScopedName namespaceXsdDecimal nam+    , dmModf = [ f0 ]+    , dmAppf = makeVmod20+    }+    where+        f0 vs@[v1,v2] = if rel v1 v2 then vs else []+        f0 _          = []++-- |rulesetXsdDecimal contains rules and axioms that allow additional+--  deductions when xsd:double values appear in a graph.+--+--  The rules defined here are concerned with basic decimal arithmetic+--  operations: +, -, *, /, **+--+--  makeRuleset :: Namespace -> [Formula ex] -> [Rule ex] -> Ruleset ex+--+rdfRulesetXsdDecimal :: RDFRuleset+rdfRulesetXsdDecimal =+    makeRuleset namespaceXsdDecimal axiomsXsdDecimal rulesXsdDecimal++mkPrefix :: Namespace -> B.Builder+mkPrefix = namespaceToBuilder++prefixXsdDecimal :: B.Builder+prefixXsdDecimal = +  mconcat+  [ mkPrefix namespaceRDF+  , mkPrefix namespaceRDFS+  , mkPrefix namespaceRDFD+  , mkPrefix namespaceXSD+  , mkPrefix namespaceXsdDecimal+  ]++mkAxiom :: T.Text -> B.Builder -> RDFFormula+mkAxiom local gr =+    makeRDFFormula namespaceXsdDecimal local (prefixXsdDecimal `mappend` gr)++axiomsXsdDecimal :: [RDFFormula]+axiomsXsdDecimal =+    [ mkAxiom "dt"      "xsd:double rdf:type rdfs:Datatype ."+    ]++rulesXsdDecimal :: [RDFRule]+rulesXsdDecimal = makeRDFDatatypeRestrictionRules rdfDatatypeValXsdDecimal gr+    where+        gr = makeRDFGraphFromN3Builder rulesXsdDecimalBuilder++--- I have removed the newline which was added between each line+--- to improve the clarity of parser errors.+---+rulesXsdDecimalBuilder :: B.Builder+rulesXsdDecimalBuilder = +  mconcat+  [ prefixXsdDecimal+    , "xsd_decimal:Abs a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:abs ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Neg a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:neg ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Sum a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2 rdf:_3) ; "+    , "  rdfd:constraint xsd_decimal:sum ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Diff a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2 rdf:_3) ; "+    , "  rdfd:constraint xsd_decimal:diff ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Prod a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2 rdf:_3) ; "+    , "  rdfd:constraint xsd_decimal:prod ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:DivMod a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2 rdf:_3 rdf:_4) ; "+    , "  rdfd:constraint xsd_decimal:divmod ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Power a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2 rdf:_3) ; "+    , "  rdfd:constraint xsd_decimal:power ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Eq a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:eq ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Ne a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:ne ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Lt a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:lt ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Le a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:le ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Gt a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:gt ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    , "xsd_decimal:Ge a rdfd:GeneralRestriction ; "+    , "  rdfd:onProperties (rdf:_1 rdf:_2) ; "+    , "  rdfd:constraint xsd_decimal:ge ; "+    , "  rdfd:maxCardinality \"1\"^^xsd:nonNegativeInteger . "+    ]+  +--------------------------------------------------------------------------------+--+--  Copyright (c) 2003, Graham Klyne, 2009 Vasili I Galchin,+--                2011 Douglas Burke, 2011 William Waites+--  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+--+--------------------------------------------------------------------------------
+ src/Swish/RDF/Vocabulary/Provenance.hs view
@@ -0,0 +1,282 @@+{-# LANGUAGE OverloadedStrings #-}++--------------------------------------------------------------------------------+--  See end of this file for licence information.+--------------------------------------------------------------------------------+-- |+--  Module      :  Swish.RDF.Vocabulary.Provenance+--  Copyright   :  (c) 2012 Douglas Burke+--  License     :  GPL V2+--+--  Maintainer  :  Douglas Burke+--  Stability   :  experimental+--  Portability :  OverloadedStrings+--+--  This module defines some vocabulary terms from the Provenance Ontology+--  <http://www.w3.org/TR/prov-o/> by the W3C Provenance Working Group+--  (<http://www.w3.org/2011/prov/wiki/Main_Page/>).+--  This is /experimental/ since the Ontology is still a Working Draft.+--+--------------------------------------------------------------------------------++module Swish.RDF.Vocabulary.Provenance+    ( +      -- | The version used for this module is +      --   \"W3C Working Draft 13 December 2011\",+      --   <http://www.w3.org/TR/2011/WD-prov-o-20111213/>.+      namespacePROV+      +      -- * Classes+      , provActivity+      , provAgent+      , provControl+      , provEntity+      , provGeneration+      , provLocation+      , provParticipation+      , provProvenanceContainer+      , provQualifiedInvolvement+      , provRecipe+      , provRole+      , provUsage+        +      -- * Properties+      , provdependedOn+      , provendedAt+      , provhadLocation+      , provhadOriginalSource+      , provhadParticipant+      , provhadQualifiedControl+      , provhadQualifiedEntity+      , provhadQualifiedGeneration+      , provhadQualifiedParticipation+      , provhadQualifiedUsage+      , provhadRecipe+      , provhadRole+      , provhadTemporalValue+      , provstartedAt+      , provused+      , provwasAttributedTo+      , provwasComplementOf+      , provwasControlledBy+      , provwasDerivedFrom+      , provwasEventuallyDerivedFrom+      , provwasGeneratedAt+      , provwasGeneratedBy+      , provwasInformedBy+      , provwasQuoteOf+      , provwasRevisionOf+      , provwasScheduledAfter+      , provwasSummaryOf+        +    )+where++import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName, makeNSScopedName)++import Data.Maybe (fromMaybe)+import Network.URI (URI, parseURI)++import qualified Data.Text as T++------------------------------------------------------------+--  Namespace+------------------------------------------------------------++provURI :: URI+provURI = fromMaybe (error "Internal error processing PROV URI") $ parseURI "http://www.w3.org/ns/prov-o/"++-- | Maps @prov@ to <http://www.w3.org/ns/prov-o/>.+namespacePROV :: Namespace+namespacePROV = makeNamespace (Just "prov") provURI++------------------------------------------------------------+--  Terms+------------------------------------------------------------++toS :: T.Text -> ScopedName+toS  = makeNSScopedName namespacePROV++-- Classes++-- | @prov:Activity@ from <http://www.w3.org/TR/prov-o/#activity>.+provActivity :: ScopedName+provActivity = toS "Activity"++-- | @prov:Agent@ from <http://www.w3.org/TR/prov-o/#agent>.+provAgent :: ScopedName+provAgent = toS "Agent"++-- | @prov:Control@ from <http://www.w3.org/TR/prov-o/#control>.+provControl :: ScopedName+provControl = toS "Control"++-- | @prov:Entity@ from <http://www.w3.org/TR/prov-o/#entity>.+provEntity :: ScopedName+provEntity = toS "Entity"++-- | @prov:Generation@ from <http://www.w3.org/TR/prov-o/#generation>.+provGeneration :: ScopedName+provGeneration = toS "Generation"++-- | @prov:Location@ from <http://www.w3.org/TR/prov-o/#location>.+provLocation :: ScopedName+provLocation = toS "Location"++-- | @prov:Participation@ from <http://www.w3.org/TR/prov-o/#participation>.+provParticipation :: ScopedName+provParticipation = toS "Participation"++-- | @prov:ProvenanceContainer@ from <http://www.w3.org/TR/prov-o/#provenancecontainer>.+provProvenanceContainer :: ScopedName+provProvenanceContainer = toS "ProvenanceContainer"++-- | @prov:QualifiedInvolvement@ from <http://www.w3.org/TR/prov-o/#qualifiedinvolvement>.+provQualifiedInvolvement :: ScopedName+provQualifiedInvolvement = toS "QualifiedInvolvement"++-- | @prov:Recipe@ from <http://www.w3.org/TR/prov-o/#recipe>.+provRecipe :: ScopedName+provRecipe = toS "Recipe"++-- | @prov:Role@ from <http://www.w3.org/TR/prov-o/#role>.+provRole :: ScopedName+provRole = toS "Role"++-- | @prov:Usage@ from <http://www.w3.org/TR/prov-o/#usage>.+provUsage :: ScopedName+provUsage = toS "Usage"++-- Properties++-- | @prov:dependedOn@ from <http://www.w3.org/TR/prov-o/#dependedon>.+provdependedOn :: ScopedName+provdependedOn = toS "dependedOn"++-- | @prov:endedAt@ from <http://www.w3.org/TR/prov-o/#endedat>.+provendedAt :: ScopedName+provendedAt = toS "endedAt"++-- | @prov:hadLocation@ from <http://www.w3.org/TR/prov-o/#hadlocation>.+provhadLocation :: ScopedName+provhadLocation = toS "hadLocation"++-- | @prov:hadOriginalSource@ from <http://www.w3.org/TR/prov-o/#hadoriginalsource>.+provhadOriginalSource :: ScopedName+provhadOriginalSource = toS "hadOriginalSource"++-- | @prov:hadParticipant@ from <http://www.w3.org/TR/prov-o/#hadparticipant>.+provhadParticipant :: ScopedName+provhadParticipant = toS "hadParticipant"++-- | @prov:hadQualifiedControl@ from <http://www.w3.org/TR/prov-o/#hadqualifiedcontrol>.+provhadQualifiedControl :: ScopedName+provhadQualifiedControl = toS "hadQualifiedControl"++-- | @prov:hadQualifiedEntity@ from <http://www.w3.org/TR/prov-o/#hadqualifiedentity>.+provhadQualifiedEntity :: ScopedName+provhadQualifiedEntity = toS "hadQualifiedEntity"++-- | @prov:hadQualifiedGeneration@ from <http://www.w3.org/TR/prov-o/#hadqualifiedgeneration>.+provhadQualifiedGeneration :: ScopedName+provhadQualifiedGeneration = toS "hadQualifiedGeneration"++-- | @prov:hadQualifiedParticipation@ from <http://www.w3.org/TR/prov-o/#hadqualifiedparticipation>.+provhadQualifiedParticipation :: ScopedName+provhadQualifiedParticipation = toS "hadQualifiedParticipation"++-- | @prov:hadQualifiedUsage@ from <http://www.w3.org/TR/prov-o/#hadqualifiedusage>.+provhadQualifiedUsage :: ScopedName+provhadQualifiedUsage = toS "hadQualifiedUsage"++-- | @prov:hadRecipe@ from <http://www.w3.org/TR/prov-o/#hadrecipe>.+provhadRecipe :: ScopedName+provhadRecipe = toS "hadRecipe"++-- | @prov:hadRole@ from <http://www.w3.org/TR/prov-o/#hadrole>.+provhadRole :: ScopedName+provhadRole = toS "hadRole"++-- | @prov:hadTemporalValue@ from <http://www.w3.org/TR/prov-o/#hadtemporalvalue>.+provhadTemporalValue :: ScopedName+provhadTemporalValue = toS "hadTemporalValue"++-- | @prov:startedAt@ from <http://www.w3.org/TR/prov-o/#startedat>.+provstartedAt :: ScopedName+provstartedAt = toS "startedAt"++-- | @prov:used@ from <http://www.w3.org/TR/prov-o/#used>.+provused :: ScopedName+provused = toS "used"++-- | @prov:wasAttributedTo@ from <http://www.w3.org/TR/prov-o/#wasattributedto>.+provwasAttributedTo :: ScopedName+provwasAttributedTo = toS "wasAttributedTo"++-- | @prov:wasComplementOf@ from <http://www.w3.org/TR/prov-o/#wascomplementof>.+provwasComplementOf :: ScopedName+provwasComplementOf = toS "wasComplementOf"++-- | @prov:wasControlledBy@ from <http://www.w3.org/TR/prov-o/#wascontrolledby>.+provwasControlledBy :: ScopedName+provwasControlledBy = toS "wasControlledBy"++-- | @prov:wasDerivedFrom@ from <http://www.w3.org/TR/prov-o/#wasderivedfrom>.+provwasDerivedFrom :: ScopedName+provwasDerivedFrom = toS "wasDerivedFrom"++-- | @prov:wasEventuallyDerivedFrom@ from <http://www.w3.org/TR/prov-o/#waseventuallyderivedfrom>.+provwasEventuallyDerivedFrom :: ScopedName+provwasEventuallyDerivedFrom = toS "wasEventuallyDerivedFrom"++-- | @prov:wasGeneratedAt@ from <http://www.w3.org/TR/prov-o/#wasgeneratedat>.+provwasGeneratedAt :: ScopedName+provwasGeneratedAt = toS "wasGeneratedAt"++-- | @prov:wasGeneratedBy@ from <http://www.w3.org/TR/prov-o/#wasgeneratedby>.+provwasGeneratedBy :: ScopedName+provwasGeneratedBy = toS "wasGeneratedBy"++-- | @prov:wasInformedBy@ from <http://www.w3.org/TR/prov-o/#wasinformedby>.+provwasInformedBy :: ScopedName+provwasInformedBy = toS "wasInformedBy"++-- | @prov:wasQuoteOf@ from <http://www.w3.org/TR/prov-o/#wasquoteof>.+provwasQuoteOf :: ScopedName+provwasQuoteOf = toS "wasQuoteOf"++-- | @prov:wasRevisionOf@ from <http://www.w3.org/TR/prov-o/#wasrevisionof>.+provwasRevisionOf :: ScopedName+provwasRevisionOf = toS "wasRevisionOf"++-- | @prov:wasScheduledAfter@ from <http://www.w3.org/TR/prov-o/#wasscheduledafter>.+provwasScheduledAfter :: ScopedName+provwasScheduledAfter = toS "wasScheduledAfter"++-- | @prov:wasSummaryOf@ from <http://www.w3.org/TR/prov-o/#wassummaryof>.+provwasSummaryOf :: ScopedName+provwasSummaryOf = toS "wasSummaryOf"++--------------------------------------------------------------------------------+--+--  Copyright (c) 2012 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+--+--------------------------------------------------------------------------------
src/Swish/Utils/PartOrderedCollection.hs view
@@ -60,7 +60,7 @@ --  for which there is no larger element in the list. -- maxima :: PartCompare a -> [a] -> [a]-maxima cmp as = foldl' add [] as+maxima cmp = foldl' add []      where         add []     e = [e]         add ms@(m:mr) e = case cmp m e of
swish.cabal view
@@ -1,10 +1,10 @@ Name:               swish-Version:            0.6.3.0+Version:            0.6.4.0 Stability:          experimental License:            LGPL License-file:       LICENSE  Author:             Graham Klyne - GK@ninebynine.org-Copyright:          (c) 2003, 2004 G. Klyne; 2009 Vasili I Galchin; 2011 Doug Burke; All rights reserved.+Copyright:          (c) 2003, 2004 G. Klyne; 2009 Vasili I Galchin; 2011, 2012 Doug Burke; All rights reserved. Maintainer:         dburke@cfa.harvard.edu Category:           Semantic Web Synopsis:           A semantic web toolkit. @@ -46,6 +46,10 @@   .   Changes:   .+  [Version 0.6.4.0] Added support for xsd:decimal with "Swish.RDF.RDFDatatypeXsdDecimal"+  and "Swish.RDF.MapXsdDecimal" thanks to William Waites <https://bitbucket.org/ww>.+  Added "Swish.RDF.Vocabulary.Provenance".+  .   [Version 0.6.3.0] Added "Swish.RDF.Vocabulary.SIOC".   .   [Version 0.6.2.1] Hackage did not want to upload @0.6.2.0@, so re-try by @@ -222,6 +226,7 @@       Swish.RDF.GraphMatch       Swish.RDF.GraphMem       Swish.RDF.GraphPartition+      Swish.RDF.MapXsdDecimal       Swish.RDF.MapXsdInteger       Swish.RDF.NTFormatter       Swish.RDF.NTParser@@ -229,6 +234,7 @@       Swish.RDF.N3Parser       Swish.RDF.Proof       Swish.RDF.RDFDatatype+      Swish.RDF.RDFDatatypeXsdDecimal       Swish.RDF.RDFDatatypeXsdInteger       Swish.RDF.RDFDatatypeXsdString       Swish.RDF.RDFGraph@@ -253,6 +259,7 @@       Swish.RDF.Vocabulary.FOAF       Swish.RDF.Vocabulary.Geo       Swish.RDF.Vocabulary.OWL+      Swish.RDF.Vocabulary.Provenance       Swish.RDF.Vocabulary.RDF       Swish.RDF.Vocabulary.SIOC       Swish.RDF.Vocabulary.XSD@@ -709,4 +716,3 @@       filepath >= 1.1 && < 1.3,       hashable == 1.1.*,       intern == 0.8.*-