packages feed

swish 0.4.0.0 → 0.5.0.0

raw patch · 36 files changed

+383/−339 lines, 36 files

Files

Swish/RDF/BuiltInDatatypes.hs view
@@ -16,25 +16,15 @@ --------------------------------------------------------------------------------  module Swish.RDF.BuiltInDatatypes-    ( allDatatypes, findRDFDatatype )-where--import Swish.RDF.RDFDatatype-    ( RDFDatatype-    )--import Swish.Utils.LookupMap-    ( LookupMap(..), mapFindMaybe-    )--import Swish.Utils.Namespace-    ( ScopedName(..) )+       ( allDatatypes, findRDFDatatype )+    where -import Swish.RDF.RDFDatatypeXsdString-    ( rdfDatatypeXsdString )+import Swish.RDF.RDFDatatype (RDFDatatype) -import Swish.RDF.RDFDatatypeXsdInteger-    ( rdfDatatypeXsdInteger )+import Swish.Utils.LookupMap (LookupMap(..), mapFindMaybe)+import Swish.Utils.Namespace (ScopedName)+import Swish.RDF.RDFDatatypeXsdString (rdfDatatypeXsdString)+import Swish.RDF.RDFDatatypeXsdInteger (rdfDatatypeXsdInteger)  ------------------------------------------------------------ --  Declare datatype map
Swish/RDF/BuiltInRules.hs view
@@ -49,7 +49,7 @@  import Swish.RDF.Datatype (typeRules, typeMkModifiers) import Swish.Utils.LookupMap (LookupMap(..), mapFindMaybe)-import Swish.Utils.Namespace (ScopedName(..))+import Swish.Utils.Namespace (ScopedName)  ------------------------------------------------------------ --  Declare variable binding filters list
Swish/RDF/ClassRestrictionRule.hs view
@@ -53,7 +53,7 @@ import Swish.RDF.VarBinding (VarBinding(..)) import Swish.RDF.Vocabulary (namespaceRDFD) -import Swish.Utils.Namespace (Namespace(..),ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, ScopedName, namespaceToBuilder) import Swish.Utils.PartOrderedCollection     ( minima, maxima     , partCompareEq, partComparePair
Swish/RDF/Datatype.hs view
@@ -63,12 +63,8 @@     , Rule(..)     ) -import Swish.Utils.Namespace-    ( ScopedName(..)-    )--import Swish.RDF.Vocabulary-    ( swishName )+import Swish.RDF.Vocabulary (swishName)+import Swish.Utils.Namespace (ScopedName)  import Swish.RDF.VarBinding     ( VarBinding(..)
Swish/RDF/N3Formatter.hs view
@@ -90,8 +90,7 @@     , mapFind, mapFindMaybe, mapAdd, mapDelete, mapMerge     ) -import Swish.Utils.Namespace-    ( ScopedName(..), getScopeURI )+import Swish.Utils.Namespace (ScopedName, getScopeLocal, getScopeURI)  import Data.Char (isDigit) @@ -733,7 +732,7 @@     Nothing -> do       pr <- getPrefixes       let nsuri  = getScopeURI sn-          local  = snLocal sn+          local  = getScopeLocal sn           premap = reverseLookupMap pr :: RevNamespaceMap           prefix = mapFindMaybe nsuri premap           
Swish/RDF/N3Parser.hs view
@@ -87,11 +87,14 @@     , mapFind, mapFindMaybe, mapReplaceOrAdd, mapAdd, mapReplace )  import Swish.Utils.Namespace-    ( Namespace(..)-    , ScopedName(..)+    ( Namespace, makeNamespace+    , ScopedName+    , getScopeNamespace     , getScopedNameURI+    , getScopeNamespace     , makeURIScopedName     , makeQNameScopedName+    , makeNSScopedName     , nullScopedName     ) @@ -162,7 +165,7 @@ setPrefix :: Maybe T.Text -> URI -> N3State -> N3State setPrefix pre uri st =  st { prefixUris=p' }     where-        p' = mapReplaceOrAdd (Namespace pre uri) (prefixUris st)+        p' = mapReplaceOrAdd (makeNamespace pre uri) (prefixUris st)  -- | Set name for special syntax element setSName :: String -> ScopedName -> N3State -> N3State@@ -247,8 +250,8 @@                     -> L.Text       -- ^ input to be parsed                     -> Either String a parseAnyfromText parser mbase input =-  let pmap   = LookupMap [Namespace Nothing hashURI]-      muri   = fmap makeQNameScopedName mbase+  let pmap   = LookupMap [makeNamespace Nothing hashURI]+      muri   = fmap (makeQNameScopedName Nothing) mbase       smap   = LookupMap $ specialTable muri       pstate = N3State               { graphState = emptyRDFGraph@@ -382,9 +385,10 @@      -} operatorLabel :: ScopedName -> N3Parser RDFLabel-operatorLabel snam@(ScopedName sns _) = do+operatorLabel snam = do   st <- stGet-  let opmap = prefixUris st+  let sns = getScopeNamespace snam+      opmap = prefixUris st       pkey = entryKey sns       pval = entryVal sns       @@ -421,7 +425,7 @@   let stmt = arc s p o       oldp = prefixUris ost       ogs = graphState ost-      newp = mapReplaceOrAdd (snScope dtype) oldp+      newp = mapReplaceOrAdd (getScopeNamespace dtype) oldp   stUpdate $ \st -> st { prefixUris = newp, graphState = addArc stmt ogs } addStatement s p o = stUpdate (updateGraph (addArc (arc s p o) )) @@ -572,7 +576,7 @@ getDefaultPrefix = do   s <- stGet   case getPrefixURI s Nothing of-    Just uri -> return $ Namespace Nothing uri+    Just uri -> return $ makeNamespace Nothing uri     _ -> fail "No default prefix defined; how unexpected!"  addBase :: URI -> N3Parser ()@@ -731,34 +735,34 @@  qname :: N3Parser ScopedName qname =-  (char ':' *> toSN getDefaultPrefix)+  -- (char ':' *> toSN getDefaultPrefix)+  (char ':' >> g >>= return . uncurry makeNSScopedName)   <|> (n3Name >>= fullOrLocalQName)     where-      toSN p = ScopedName <$> p <*> (n3Name <|> return "")-          +      g = (,) <$> getDefaultPrefix <*> (n3Name <|> return "")+                fullOrLocalQName :: T.Text -> N3Parser ScopedName fullOrLocalQName name =    (char ':' *> fullQName name)   <|> localQName name    fullQName :: T.Text -> N3Parser ScopedName-fullQName name = do-  pre <- findPrefix name-  lname <- n3Name <|> return ""-  return $ ScopedName pre lname+fullQName name = makeNSScopedName <$> findPrefix name <*> (n3Name <|> pure "")    findPrefix :: T.Text -> N3Parser Namespace findPrefix pre = do   st <- stGet   case mapFindMaybe (Just pre) (prefixUris st) of-    Just uri -> return $ Namespace (Just pre) uri+    Just uri -> return $ makeNamespace (Just pre) uri     Nothing  -> failBad $ "Prefix '" ++ T.unpack pre ++ ":' not bound."    localQName :: T.Text -> N3Parser ScopedName localQName name = do   st <- stGet   if getAllowLocalNames st-    then ScopedName <$> getDefaultPrefix <*> pure name+    then let g = (,) <$> getDefaultPrefix <*> pure name+         in uncurry makeNSScopedName <$> g+                 else fail ("Invalid 'bare' word: " ++ T.unpack name)-- TODO: not ideal error message; can we handle this case differently?  {-
Swish/RDF/NTFormatter.hs view
@@ -39,7 +39,7 @@ import Swish.RDF.GraphClass     ( Arc(..) ) -import Swish.Utils.Namespace (ScopedName(..), nsURI)+import Swish.Utils.Namespace (ScopedName, getQName) import Swish.RDF.Vocabulary (isLang, langTag)  import Swish.Utils.LookupMap@@ -170,9 +170,13 @@  -- TODO: can we use Network.URI to protect the URI? showScopedName :: ScopedName -> B.Builder+{- showScopedName (ScopedName n l) =    let uri = T.pack (show (nsURI n)) `mappend` l   in mconcat ["<", B.fromText (quote uri), ">"]+-}+-- showScopedName s = mconcat ["<", B.fromText (quote (T.pack (show (getQName s)))), ">"]+showScopedName s = B.fromText (quote (T.pack (show (getQName s)))) -- looks like qname already adds the <> around this  {- Swish.Utils.MiscHelpers contains a quote routine
Swish/RDF/NTParser.hs view
@@ -49,7 +49,7 @@  import Swish.RDF.GraphClass (arc) -import Swish.Utils.Namespace (ScopedName(..), makeURIScopedName)+import Swish.Utils.Namespace (ScopedName, makeURIScopedName)  import Swish.RDF.Vocabulary (langName) 
Swish/RDF/RDFDatatype.hs view
@@ -46,11 +46,8 @@     , DatatypeSub(..)     ) -import Swish.Utils.Namespace-    ( ScopedName(..) )--import Swish.RDF.VarBinding-    ( VarBindingModify(..) )+import Swish.RDF.VarBinding (VarBindingModify(..))+import Swish.Utils.Namespace (ScopedName)  import Control.Monad (liftM) import Data.Maybe (fromMaybe, isJust, fromJust)
Swish/RDF/RDFDatatypeXsdInteger.hs view
@@ -59,7 +59,7 @@  import Swish.RDF.Ruleset (makeRuleset) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, ScopedName, namespaceToBuilder, makeNSScopedName)  import Swish.RDF.Vocabulary     ( namespaceRDF@@ -86,7 +86,7 @@  -- |Type name for xsd:integer datatype typeNameXsdInteger :: ScopedName-typeNameXsdInteger  = ScopedName namespaceXSD nameXsdInteger+typeNameXsdInteger  = makeNSScopedName namespaceXSD nameXsdInteger  -- |Namespace for xsd:integer datatype functions namespaceXsdInteger :: Namespace@@ -169,7 +169,7 @@     T.Text -> DatatypeRelPr Integer -> UnaryFnTable Integer     -> DatatypeRel Integer mkIntRel2 nam pr fns = DatatypeRel-    { dtRelName = ScopedName namespaceXsdInteger nam+    { dtRelName = makeNSScopedName namespaceXsdInteger nam     , dtRelFunc = altArgs pr fns unaryFnApp     } @@ -177,7 +177,7 @@     T.Text -> DatatypeRelPr Integer -> BinaryFnTable Integer     -> DatatypeRel Integer mkIntRel3 nam pr fns = DatatypeRel-    { dtRelName = ScopedName namespaceXsdInteger nam+    { dtRelName = makeNSScopedName namespaceXsdInteger nam     , dtRelFunc = altArgs pr fns binaryFnApp     } @@ -185,7 +185,7 @@     T.Text -> DatatypeRelPr Integer -> BinMaybeFnTable Integer     -> DatatypeRel Integer mkIntRel3maybe nam pr fns = DatatypeRel-    { dtRelName = ScopedName namespaceXsdInteger nam+    { dtRelName = makeNSScopedName namespaceXsdInteger nam     , dtRelFunc = altArgs pr fns binMaybeFnApp     } @@ -304,7 +304,7 @@  modXsdIntegerAbs :: RDFDatatypeMod Integer modXsdIntegerAbs = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "abs"+    { dmName = makeNSScopedName namespaceXsdInteger "abs"     , dmModf = [ f0, f1 ]     , dmAppf = makeVmod11     }@@ -316,7 +316,7 @@  modXsdIntegerNeg :: RDFDatatypeMod Integer modXsdIntegerNeg = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "neg"+    { dmName = makeNSScopedName namespaceXsdInteger "neg"     , dmModf = [ f0, f1, f1 ]     , dmAppf = makeVmod11inv     }@@ -328,7 +328,7 @@  modXsdIntegerSum :: RDFDatatypeMod Integer modXsdIntegerSum = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "sum"+    { dmName = makeNSScopedName namespaceXsdInteger "sum"     , dmModf = [ f0, f1, f2, f2 ]     , dmAppf = makeVmod21inv     }@@ -342,7 +342,7 @@  modXsdIntegerDiff :: RDFDatatypeMod Integer modXsdIntegerDiff = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "diff"+    { dmName = makeNSScopedName namespaceXsdInteger "diff"     , dmModf = [ f0, f1, f2, f3 ]     , dmAppf = makeVmod21inv     }@@ -358,7 +358,7 @@  modXsdIntegerProd :: RDFDatatypeMod Integer modXsdIntegerProd = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "prod"+    { dmName = makeNSScopedName namespaceXsdInteger "prod"     , dmModf = [ f0, f1, f2, f2 ]     , dmAppf = makeVmod21inv     }@@ -373,7 +373,7 @@  modXsdIntegerDivMod :: RDFDatatypeMod Integer modXsdIntegerDivMod = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "divmod"+    { dmName = makeNSScopedName namespaceXsdInteger "divmod"     , dmModf = [ f0, f1 ]     , dmAppf = makeVmod22     }@@ -385,7 +385,7 @@  modXsdIntegerPower :: RDFDatatypeMod Integer modXsdIntegerPower = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger "power"+    { dmName = makeNSScopedName namespaceXsdInteger "power"     , dmModf = [ f0, f1 ]     , dmAppf = makeVmod21     }@@ -406,7 +406,7 @@ modXsdIntegerCompare ::     T.Text -> (Integer->Integer->Bool) -> RDFDatatypeMod Integer modXsdIntegerCompare nam rel = DatatypeMod-    { dmName = ScopedName namespaceXsdInteger nam+    { dmName = makeNSScopedName namespaceXsdInteger nam     , dmModf = [ f0 ]     , dmAppf = makeVmod20     }
Swish/RDF/RDFDatatypeXsdString.hs view
@@ -59,7 +59,7 @@     )  import Swish.RDF.Ruleset (makeRuleset)-import Swish.Utils.Namespace (Namespace(..), ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, ScopedName, namespaceToBuilder, makeNSScopedName)  import Swish.RDF.Vocabulary     ( namespaceRDF@@ -84,9 +84,9 @@ nameXsdString :: T.Text nameXsdString = "string" --- |Type name for @xsd:string@ datatype+-- | Type name for @xsd:string@ datatype typeNameXsdString :: ScopedName-typeNameXsdString  = ScopedName namespaceXSD nameXsdString+typeNameXsdString  = makeNSScopedName namespaceXSD nameXsdString  -- |Namespace for @xsd:string@ datatype functions namespaceXsdString :: Namespace@@ -138,8 +138,9 @@ mkStrRel2 ::     T.Text -> DatatypeRelPr T.Text -> UnaryFnTable T.Text     -> DatatypeRel T.Text-mkStrRel2 nam pr fns = DatatypeRel-    { dtRelName = ScopedName namespaceXsdString nam+mkStrRel2 nam pr fns = +  DatatypeRel+    { dtRelName = makeNSScopedName namespaceXsdString nam     , dtRelFunc = altArgs pr fns unaryFnApp     } @@ -194,7 +195,7 @@ modXsdStringCompare ::     T.Text -> (T.Text->T.Text->Bool) -> RDFDatatypeMod T.Text modXsdStringCompare nam rel = DatatypeMod-    { dmName = ScopedName namespaceXsdString nam+    { dmName = makeNSScopedName namespaceXsdString nam     , dmModf = [ f0 ]     , dmAppf = makeVmod20     }@@ -285,7 +286,7 @@ stringPlainValue ::     RDFLabel -> RDFLabel -> RDFVarBindingModify stringPlainValue svar lvar = VarBindingModify-        { vbmName   = ScopedName namespaceRDFD "stringPlain"+        { vbmName   = makeNSScopedName namespaceRDFD "stringPlain"         , vbmApply  = concatMap app1         , vbmVocab  = [svar,lvar]         , vbmUsage  = [[svar],[lvar],[]]
Swish/RDF/RDFGraph.hs view
@@ -64,9 +64,10 @@     where  import Swish.Utils.Namespace-    ( Namespace(..)+    ( Namespace, makeNamespace, getNamespaceTuple     , getScopedNameURI-    , ScopedName(..)+    , ScopedName+    , getScopeLocal, getScopeNamespace     , getQName     , makeQNameScopedName     , makeURIScopedName@@ -121,11 +122,15 @@ import Data.Char (ord, isDigit) import Data.List (intersect, union, findIndices, foldl') import Data.Ord (comparing)+-- import Data.Tuple (swap) not in 6.12.3 import Data.String (IsString(..)) import Data.Time (UTCTime, Day, ParseTime, parseTime, formatTime) import System.Locale (defaultTimeLocale)   import Text.Printf +swap :: (a,b) -> (b,a)+swap (a,b) = (b,a)+ -- | RDF graph node values -- --  cf. <http://www.w3.org/TR/rdf-concepts/#section-Graph-syntax>@@ -208,7 +213,7 @@     labelIsVar _            = False     getLocal   (Blank loc)  = loc     getLocal   (Var   loc)  = '?':loc-    getLocal   (Res   sn)   = "Res_" ++ T.unpack (snLocal sn)+    getLocal   (Res   sn)   = "Res_" ++ T.unpack (getScopeLocal sn)     getLocal   (NoNode)     = "None"     getLocal   _            = "Lit_"     makeLabel  ('?':loc)    = Var loc@@ -522,7 +527,7 @@    -- | Converts to a Resource. instance ToRDFLabel QName where  -  toRDFLabel = Res . makeQNameScopedName+  toRDFLabel = Res . makeQNameScopedName Nothing    -- | Converts from a Resource. instance FromRDFLabel QName where@@ -658,11 +663,11 @@ --  first character of local name is '_' and --  remaining characters of local name are all digits isMemberProp :: RDFLabel -> Bool-isMemberProp (Res sn) = snScope sn == namespaceRDF &&+isMemberProp (Res sn) = getScopeNamespace sn == namespaceRDF &&                         T.head loc   == '_' &&                         T.all isDigit (T.tail loc)                         where-                            loc = snLocal sn+                            loc = getScopeLocal sn isMemberProp _        = False  -- |Test if supplied labal is a blank node@@ -732,8 +737,8 @@ data RevNamespace = RevNamespace Namespace  instance LookupEntryClass RevNamespace URI (Maybe T.Text) where-    keyVal   (RevNamespace (Namespace pre uri)) = (uri,pre)-    newEntry (uri,pre) = RevNamespace (Namespace pre uri)+    keyVal   (RevNamespace ns) = swap $ getNamespaceTuple ns+    newEntry (uri,pre) = RevNamespace (makeNamespace pre uri)  type RevNamespaceMap = LookupMap RevNamespace @@ -1080,8 +1085,8 @@ -- toRDFGraph arcs = emptyRDFGraph { statements = arcs } toRDFGraph arcs =    let lbls = concatMap (\(Arc s p o) -> [s,p,o]) arcs-      ns1  = map (snScope . getScopedName) (filter isUri lbls)-      ns2  = map (snScope . getDataType) (filter isTypedLiteral lbls)+      ns1  = map (getScopeNamespace . getScopedName) (filter isUri lbls)+      ns2  = map (getScopeNamespace . getDataType) (filter isTypedLiteral lbls)       getDataType (Lit _ (Just dt)) = dt       getDataType _ = nullScopedName -- should not happen       nsmap = foldl' mapAddIfNew emptyNamespaceMap (ns1++ns2)
Swish/RDF/RDFParser.hs view
@@ -63,7 +63,7 @@     )  import Swish.Utils.LookupMap (LookupMap(..))-import Swish.Utils.Namespace (Namespace(..), ScopedName(..))+import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName)  import qualified Data.Text      as T import qualified Data.Text.Lazy as L@@ -122,7 +122,7 @@                 , namespaceRDFD     -- datatypes                 , namespaceOWL                 , namespaceLOG-                , Namespace Nothing $ fromJust (parseURIReference "#") -- is this correct?+                , makeNamespace Nothing $ fromJust (parseURIReference "#") -- is this correct?                 ]  {-|@@ -285,7 +285,7 @@   case mhex of     Left emsg     -> failBad $ "Internal error: unable to parse hex4: " ++ emsg     Right (v, "") -> return $ chr v-    Right (_, vs) -> failBad $ "Internal error: hex4 has remained of " ++ T.unpack vs+    Right (_, vs) -> failBad $ "Internal error: hex4 remainder = " ++ T.unpack vs          hex8 :: Parser a Char hex8 = do@@ -296,7 +296,7 @@     Right (v, "") -> if v <= 0x10FFFF                      then return $ chr v                      else failBad "\\UHHHHHHHH format is limited to a maximum of \\U0010FFFF"-    Right (_, vs) -> failBad $ "Internal error: hex8 has remained of " ++ T.unpack vs+    Right (_, vs) -> failBad $ "Internal error: hex8 remainder = " ++ T.unpack vs          -------------------------------------------------------------------------------- --
Swish/RDF/RDFProof.hs view
@@ -44,9 +44,7 @@     , toRDFGraph -}, emptyRDFGraph     ) -import Swish.RDF.VarBinding-    (  makeVarBinding-    )+import Swish.RDF.VarBinding (makeVarBinding)  import Swish.RDF.Proof     ( Proof(..), Step(..) )@@ -54,9 +52,7 @@ import Swish.RDF.Rule     ( Expression(..), Rule(..) ) -import Swish.Utils.Namespace-    ( ScopedName(..)-    )+import Swish.Utils.Namespace (ScopedName)  import Swish.RDF.GraphClass     ( Label(..), LDGraph(..), replaceArcs )
Swish/RDF/RDFProofContext.hs view
@@ -64,7 +64,7 @@  import Swish.RDF.Ruleset (makeRuleset) import Swish.RDF.Datatype (typeMkCanonicalForm)-import Swish.Utils.Namespace (Namespace(..), ScopedName(..))+import Swish.Utils.Namespace (Namespace, makeNSScopedName)  import Swish.RDF.Vocabulary     ( namespaceRDFD@@ -124,7 +124,7 @@ sameDatatypedValue ::     RDFLabel -> RDFLabel -> RDFLabel -> RDFLabel -> RDFVarBindingModify sameDatatypedValue val1 typ1 val2 typ2 = VarBindingModify-        { vbmName   = ScopedName namespaceRDFD "sameValue"+        { vbmName   = makeNSScopedName namespaceRDFD "sameValue"         , vbmApply  = sameDatatypedValueApplyAll val1 typ1 val2 typ2         , vbmVocab  = [val1,typ1,val2,typ2]         , vbmUsage  = [[val2]]@@ -261,14 +261,14 @@ --  RDF subgraph entailment (from RDF semantics document section 2) -- rdfsub :: RDFRule -rdfsub = makeRdfSubgraphEntailmentRule (ScopedName scopeRDF "sub")+rdfsub = makeRdfSubgraphEntailmentRule (makeNSScopedName scopeRDF "sub")  --  RDF simple entailment (from RDF semantics document section 7.1) --  (Note: rules se1 and se2 are combined here, because the scope of --  the "allocatedTo" modifier is the application of a single rule.) -- rdfse :: RDFRule-rdfse = makeRdfSimpleEntailmentRule (ScopedName scopeRDF "se")+rdfse = makeRdfSimpleEntailmentRule (makeNSScopedName scopeRDF "se")  --  RDF bnode-for-literal assignments (from RDF semantics document section 7.1) --
Swish/RDF/RDFRuleset.hs view
@@ -60,7 +60,7 @@ import Swish.RDF.Rule     ( Formula(..), Rule(..), RuleMap     , fwdCheckInference-    , nullScope+    , nullSN     )  import Swish.RDF.VarBinding@@ -71,7 +71,7 @@     , varBindingId     ) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, ScopedName, makeNSScopedName, namespaceToBuilder) import Swish.RDF.Vocabulary (swishName, namespaceRDF, namespaceRDFS)  {-@@ -112,7 +112,7 @@ -- | The null RDF formula. nullRDFFormula :: Formula RDFGraph nullRDFFormula = Formula-    { formName = ScopedName nullScope "nullRDFGraph"+    { formName = nullSN "nullRDFGraph"     , formExpr = emptyRDFGraph     } @@ -260,8 +260,9 @@     -> T.Text     -- ^ local name for the formula in the namespace     -> B.Builder  -- ^ graph in Notation 3 format     -> RDFFormula-makeRDFFormula scope local gr = Formula-    { formName = ScopedName scope local+makeRDFFormula scope local gr = +  Formula+    { formName = makeNSScopedName scope local     , formExpr = makeRDFGraphFromN3Builder gr     } @@ -339,7 +340,7 @@     --   'makeN3ClosureSimpleRule'.     -> RDFRule makeN3ClosureRule scope local ant con =-    makeRDFClosureRule (ScopedName scope local) [antgr] congr+    makeRDFClosureRule (makeNSScopedName scope local) [antgr] congr     where         antgr = makeRDFGraphFromN3Builder ant         congr = makeRDFGraphFromN3Builder con@@ -429,13 +430,12 @@     --   (See 'makeNodeAllocTo').     -> RDFRule makeN3ClosureAllocatorRule scope local ant con vflt aloc =-    makeRDFClosureRule (ScopedName scope local) [antgr] congr modc+    makeRDFClosureRule (makeNSScopedName scope local) [antgr] congr modc     where         antgr = makeRDFGraphFromN3Builder ant         congr = makeRDFGraphFromN3Builder con         vmod  = aloc (allLabels labelIsVar antgr)         modc  = fromMaybe varBindingId $ vbmCompose vmod vflt-  ------------------------------------------------------------ --  Query binding modifier for "allocated to" logic
Swish/RDF/Rule.hs view
@@ -21,19 +21,21 @@  module Swish.RDF.Rule        ( Expression(..), Formula(..), Rule(..), RuleMap-       , nullScope, nullFormula, nullRule+       , nullScope, nullSN, nullFormula, nullRule        , fwdCheckInference, bwdCheckInference        , showsFormula, showsFormulae, showsWidth        )        where -import Swish.Utils.Namespace (Namespace(..), ScopedName(..))+import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName, makeScopedName) import Swish.Utils.LookupMap (LookupEntryClass(..), LookupMap(..)) import Swish.Utils.ShowM (ShowM(..)) -import Network.URI (parseURI)+import Network.URI (URI, parseURI) import Data.Maybe (fromJust) +import qualified Data.Text as T+ ------------------------------------------------------------ --  Expressions ------------------------------------------------------------@@ -70,13 +72,21 @@  -- | The namespace @http:\/\/id.ninebynine.org\/2003\/Ruleset\/null@ nullScope :: Namespace-nullScope = Namespace (Just "null") -            $ fromJust $ parseURI "http://id.ninebynine.org/2003/Ruleset/null"+nullScope = makeNamespace (Just "null") nullScopeURI +nullSN :: T.Text -> ScopedName+nullSN = makeScopedName (Just "null") nullScopeURI++tU :: String -> URI+tU = fromJust . parseURI++nullScopeURI :: URI+nullScopeURI = tU "http://id.ninebynine.org/2003/Ruleset/null"+ -- | The null formula. nullFormula :: Formula ex nullFormula = Formula-    { formName = ScopedName nullScope "nullFormula"+    { formName = makeScopedName (Just "null") nullScopeURI "nullFormula"     , formExpr = error "Null formula"     } @@ -191,7 +201,7 @@ -- | The null rule. nullRule :: Rule ex nullRule = Rule-    { ruleName = ScopedName nullScope "nullRule"+    { ruleName = makeScopedName (Just "null") nullScopeURI "nullRule"     , fwdApply = \ _ -> []     , bwdApply = \ _ -> []     , checkInference = \ _ _ -> False
Swish/RDF/Ruleset.hs view
@@ -29,11 +29,7 @@     ) where -import Swish.Utils.Namespace-    ( Namespace(..)-    , ScopedName(..)-    )-+import Swish.Utils.Namespace (Namespace, ScopedName) import Swish.RDF.Rule (Formula(..), Rule(..))  import Swish.Utils.LookupMap
Swish/RDF/SwishMonad.hs view
@@ -61,7 +61,7 @@     ( Formula(..)     ) -import Swish.Utils.Namespace (ScopedName(..))+import Swish.Utils.Namespace (ScopedName, getScopeNamespace) import Swish.Utils.QName (QName)  import Swish.Utils.LookupMap@@ -179,7 +179,7 @@  findRuleset ::     ScopedName -> SwishState -> Maybe RDFRuleset-findRuleset nam state = mapFindMaybe (snScope nam) (rulesets state)+findRuleset nam state = mapFindMaybe (getScopeNamespace nam) (rulesets state)  findOpenVarModify :: ScopedName -> SwishState -> Maybe RDFOpenVarBindingModify findOpenVarModify nam _ = findRDFOpenVarBindingModifier nam
Swish/RDF/SwishScript.hs view
@@ -128,7 +128,7 @@ import Swish.RDF.Rule (Formula(..), Rule(..))  import Swish.RDF.VarBinding (composeSequence) -import Swish.Utils.Namespace (ScopedName(..))+import Swish.Utils.Namespace (ScopedName, getScopeNamespace) import Swish.Utils.QName (QName, qnameFromURI) import Swish.Utils.LookupMap (mapReplaceOrAdd) import Swish.Utils.ListHelpers (equiv, flist)@@ -674,7 +674,7 @@                     (Right ags,Right rls) ->                         modRulesets (mapReplaceOrAdd rs)                         where-                            rs = makeRuleset (snScope sn) ags rls+                            rs = makeRuleset (getScopeNamespace sn) ags rls             ; modify frs             } @@ -709,7 +709,7 @@                     (Right cgr,Right dts) ->                         modRulesets (mapReplaceOrAdd rs)                         where-                            rs  = makeRuleset (snScope sn) [] rls+                            rs  = makeRuleset (getScopeNamespace sn) [] rls                             rls = concatMap (`typeMkRules` cgr) dts             ; modify frs             }
Swish/RDF/VarBinding.hs view
@@ -42,7 +42,7 @@     , makeLookupMap, mapFindMaybe     ) -import Swish.Utils.Namespace (ScopedName(..))+import Swish.Utils.Namespace (ScopedName, getScopeLocal) import Swish.RDF.Vocabulary (swishName) import Swish.Utils.ListHelpers (equiv, subset, flist, headOrNothing, permutations) @@ -307,7 +307,7 @@     (VarBindingModify nam1 app1 voc1 use1)     (VarBindingModify nam2 app2 voc2 use2)     | not (null use12) = Just VarBindingModify-        { vbmName  = swishName $ mconcat ["_", snLocal nam1, "_", snLocal nam2, "_"]+        { vbmName  = swishName $ mconcat ["_", getScopeLocal nam1, "_", getScopeLocal nam2, "_"]         , vbmApply = app2 . app1         , vbmVocab = voc1 `union` voc2         , vbmUsage = use12
Swish/RDF/Vocabulary.hs view
@@ -28,7 +28,8 @@     , namespaceLOG     , namespaceDAML     , namespaceDefault-    , namespaceSwish, swishName+    , namespaceSwish +    , swishName     , namespaceLang,  langName, langTag, isLang     , scopeRDF     , scopeRDFS@@ -49,11 +50,11 @@     ) where -import Swish.Utils.Namespace (Namespace(..), ScopedName(..))+import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName, getScopeLocal, getScopeNamespace, makeScopedName)  import Data.Monoid (mappend, mconcat) import Data.Maybe (fromMaybe)-import Network.URI (parseURI)+import Network.URI (URI, parseURI)  import qualified Data.Text as T @@ -66,8 +67,11 @@   let ustr = T.unpack utxt       uri = fromMaybe (error ("Unable to convert " ++ ustr ++ " to a URI")) $             parseURI ustr-  in Namespace (Just p) uri+  in makeNamespace (Just p) uri +toNSU :: T.Text -> URI -> Namespace+toNSU p = makeNamespace (Just p)+ namespaceXsdType :: T.Text -> Namespace namespaceXsdType dtn = toNS ("xsd_" `mappend` dtn)                        (mconcat ["http://id.ninebynine.org/2003/XMLSchema/", dtn, "#"])@@ -84,20 +88,38 @@ namespaceDefault :: Namespace namespaceLang :: Namespace -namespaceRDF     = toNS "rdf"     "http://www.w3.org/1999/02/22-rdf-syntax-ns#"-namespaceRDFS    = toNS "rdfs"    "http://www.w3.org/2000/01/rdf-schema#"-namespaceRDFD    = toNS "rdfd"    "http://id.ninebynine.org/2003/rdfext/rdfd#"-namespaceOWL     = toNS "owl"     "http://www.w3.org/2002/07/owl#"-namespaceXSD     = toNS "xsd"     "http://www.w3.org/2001/XMLSchema#"+namespaceRDF     = toNSU "rdf"    namespaceRDFURI+namespaceRDFS    = toNSU "rdfs"   namespaceRDFSURI+namespaceRDFD    = toNSU "rdfd"   namespaceRDFDURI+namespaceOWL     = toNSU "owl"    namespaceOWLURI+namespaceXSD     = toNSU "xsd"    namespaceXSDURI namespaceMATH    = toNS "math"    "http://www.w3.org/2000/10/swap/math#"-namespaceLOG     = toNS "log"     "http://www.w3.org/2000/10/swap/log#"+namespaceLOG     = toNSU "log"    namespaceLOGURI namespaceDAML    = toNS "daml"    "http://www.daml.org/2000/10/daml-ont#"-namespaceSwish   = toNS "swish"   "http://id.ninebynine.org/2003/Swish/"-namespaceLang    = toNS "lang"    "http://id.ninebynine.org/2003/Swish/Lang/" -- To be replaced by urn:ietf:params:lang?-namespaceDefault = toNS "default" "http://id.ninebynine.org/default/"+namespaceSwish   = toNSU "swish"  namespaceSwishURI+namespaceLang    = toNSU "lang"   namespaceLangURI+namespaceDefault = toNSU "default" namespaceDefaultURI +tU :: String -> URI+tU = fromMaybe (error "Internal error processing namespace URI") . parseURI++namespaceRDFURI, namespaceRDFSURI, namespaceRDFDURI, +  namespaceXSDURI, namespaceOWLURI, namespaceLOGURI,+  namespaceSwishURI, +  namespaceLangURI, namespaceDefaultURI :: URI+namespaceRDFURI   = tU "http://www.w3.org/1999/02/22-rdf-syntax-ns#"+namespaceRDFSURI  = tU "http://www.w3.org/2000/01/rdf-schema#"+namespaceRDFDURI  = tU "http://id.ninebynine.org/2003/rdfext/rdfd#"+namespaceOWLURI   = tU "http://www.w3.org/2002/07/owl#"+namespaceXSDURI   = tU "http://www.w3.org/2001/XMLSchema#"+namespaceLOGURI   = tU "http://www.w3.org/2000/10/swap/log#"+namespaceSwishURI = tU "http://id.ninebynine.org/2003/Swish/"+namespaceLangURI  = tU "http://id.ninebynine.org/2003/Swish/Lang/" -- To be replaced by urn:ietf:params:lang?  +namespaceDefaultURI = tU "http://id.ninebynine.org/default/"+ swishName :: T.Text -> ScopedName-swishName = ScopedName namespaceSwish+-- swishName = ScopedName namespaceSwish+swishName = makeScopedName (Just "swish") namespaceSwishURI  ----------------------------------------------------------- --  Language tags@@ -110,13 +132,14 @@ --  distinct labels (but future developments may change that).  langName :: T.Text -> ScopedName-langName = ScopedName namespaceLang . T.toLower+-- langName = ScopedName namespaceLang . T.toLower+langName = makeScopedName (Just "lang") namespaceLangURI . T.toLower  langTag :: ScopedName -> T.Text-langTag = snLocal+langTag = getScopeLocal  isLang :: ScopedName -> Bool-isLang sname = snScope sname == namespaceLang+isLang sname = getScopeNamespace sname == namespaceLang  ------------------------------------------------------------ --  Define namespaces for RDF rules, axioms, etc@@ -133,9 +156,9 @@ ------------------------------------------------------------  toRDF, toRDFS, toRDFD :: T.Text -> ScopedName-toRDF  = ScopedName namespaceRDF-toRDFS = ScopedName namespaceRDFS-toRDFD = ScopedName namespaceRDFD+toRDF  = makeScopedName (Just "rdf")  namespaceRDFURI+toRDFS = makeScopedName (Just "rdfs") namespaceRDFSURI+toRDFD = makeScopedName (Just "rdfd") namespaceRDFDURI  rdfDatatype   :: ScopedName rdfResource   :: ScopedName@@ -171,7 +194,7 @@ rdfdMaxCardinality     = toRDFD "maxCardinality"  xsdType             :: T.Text -> ScopedName-xsdType             = ScopedName namespaceXSD+xsdType             = makeScopedName (Just "xsd") namespaceXSDURI  xsdString           :: ScopedName xsdString           = xsdType "string"@@ -208,13 +231,13 @@ xsdDateTime = xsdType "dateTime"  owlSameAs   :: ScopedName-owlSameAs   = ScopedName namespaceOWL  "sameAs"+owlSameAs   = makeScopedName (Just "owl") namespaceOWLURI "sameAs"  logImplies  :: ScopedName-logImplies  = ScopedName namespaceLOG "implies"+logImplies  = makeScopedName (Just "log") namespaceLOGURI "implies"  defaultBase :: ScopedName-defaultBase = ScopedName namespaceDefault "base"+defaultBase = makeScopedName (Just "default") namespaceDefaultURI "base"  -------------------------------------------------------------------------------- --
Swish/Utils/Namespace.hs view
@@ -22,16 +22,19 @@ --------------------------------------------------------------------------------  module Swish.Utils.Namespace-    ( Namespace(..)-    , makeNamespaceQName+    ( Namespace+    , makeNamespace, makeNamespaceQName+      , getNamespacePrefix, getNamespaceURI, getNamespaceTuple     -- , nullNamespace-    , ScopedName(..)+    , ScopedName+    , getScopeNamespace, getScopeLocal     , getScopePrefix, getScopeURI     , getQName, getScopedNameURI     , matchName     , makeScopedName     , makeQNameScopedName     , makeURIScopedName+    , makeNSScopedName     , nullScopedName     , namespaceToBuilder     )@@ -56,14 +59,30 @@ -- |A NameSpace value consists of an optional prefix and a corresponding URI. -- -data Namespace = Namespace+data Namespace = Namespace (Maybe T.Text) URI+-- data Namespace = Namespace (Maybe T.Text) !URI+                 +{-                                   {                    nsPrefix :: Maybe T.Text                  , nsURI :: URI                  }+-}                  +getNamespacePrefix :: Namespace -> Maybe T.Text+getNamespacePrefix (Namespace p _) = p++getNamespaceURI :: Namespace -> URI+getNamespaceURI (Namespace _ u) = u++getNamespaceTuple :: Namespace -> (Maybe T.Text, URI)+getNamespaceTuple (Namespace p u) = (p, u)++-- | Equality is defined by the URI, not by the prefix+-- (so the same URI with different prefixes will be+-- considered to be equal). instance Eq Namespace where-    (==) = nsEq+  (Namespace _ u1) == (Namespace _ u2) = u1 == u2  instance Show Namespace where     show (Namespace (Just p) u) = show p ++ ":<" ++ show u ++ ">"@@ -73,8 +92,8 @@     keyVal   (Namespace pre uri) = (pre,uri)     newEntry (pre,uri)           = Namespace pre uri -nsEq :: Namespace -> Namespace -> Bool-nsEq (Namespace _ u1) (Namespace _ u2) = u1 == u2+makeNamespace :: Maybe T.Text -> URI -> Namespace+makeNamespace = Namespace  makeNamespaceQName :: Namespace -> T.Text -> QName makeNamespaceQName (Namespace _ uri) = newQName uri@@ -103,13 +122,19 @@ --  Some applications may handle null namespace URIs as meaning --  the local part is relative to some base URI. ---data ScopedName = ScopedName { snScope :: Namespace, snLocal :: T.Text }+data ScopedName = ScopedName !QName Namespace T.Text +getScopeLocal :: ScopedName -> T.Text+getScopeLocal (ScopedName _ _ l) = l++getScopeNamespace :: ScopedName -> Namespace+getScopeNamespace (ScopedName _ ns _) = ns+ getScopePrefix :: ScopedName -> Maybe T.Text-getScopePrefix = nsPrefix . snScope+getScopePrefix = getNamespacePrefix . getScopeNamespace  getScopeURI :: ScopedName -> URI-getScopeURI = nsURI . snScope+getScopeURI = getNamespaceURI . getScopeNamespace  -- | This is not total since it will fail if the input string is not a valid URI. instance IsString ScopedName where@@ -124,9 +149,9 @@     (<=) = snLe  instance Show ScopedName where-    show (ScopedName n l) = case nsPrefix n of+    show (ScopedName _ n l) = case getNamespacePrefix n of       Just pre -> T.unpack $ mconcat [pre, ":", l]-      _        -> "<" ++ show (nsURI n) ++ T.unpack l ++ ">"+      _        -> "<" ++ show (getNamespaceURI n) ++ T.unpack l ++ ">"  --  Scoped names are equal if their corresponding QNames are equal snEq :: ScopedName -> ScopedName -> Bool@@ -138,7 +163,7 @@  -- |Get QName corresponding to a scoped name getQName :: ScopedName -> QName-getQName n = newQName (getScopeURI n) (snLocal n)+getQName (ScopedName qn _ _) = qn  -- |Get URI corresponding to a scoped name (using RDF conventions) getScopedNameURI :: ScopedName -> URI@@ -153,8 +178,8 @@  -- |Construct a ScopedName from prefix, URI and local name makeScopedName :: Maybe T.Text -> URI -> T.Text -> ScopedName-makeScopedName pre nsuri =-    ScopedName (Namespace pre nsuri)+makeScopedName pre nsuri local =+  ScopedName (newQName nsuri local) (Namespace pre nsuri) local  {- TODO: should just pass URIs around.@@ -164,25 +189,18 @@ -}  -- |Construct a ScopedName from a QName-makeQNameScopedName :: QName -> ScopedName-{--The following is not correct-makeQNameScopedName qn = makeScopedName Nothing (getNamespace qn) (getLocalName qn)-since you get-swish> let sn1 = makeQNameScopedName  "file:///foo/bar/baz"-swish> sn1-<file:///foo/barbaz>--}-makeQNameScopedName qn = -  let ns = getNamespace qn-      ln = getLocalName qn-  in makeScopedName Nothing ns ln+makeQNameScopedName :: Maybe T.Text -> QName -> ScopedName+makeQNameScopedName pre qn = ScopedName qn (Namespace pre (getNamespace qn)) (getLocalName qn) --- |Construct a ScopedName for a bare URI (the label is set to \"\").+-- | Construct a ScopedName for a bare URI (the label is set to \"\"). makeURIScopedName :: URI -> ScopedName makeURIScopedName uri = makeScopedName Nothing uri "" --- |This should never appear as a valid name+-- | Construct a ScopedName from a Namespace and local component+makeNSScopedName :: Namespace -> T.Text -> ScopedName+makeNSScopedName ns local = ScopedName (newQName (getNamespaceURI ns) local) ns local++-- | This should never appear as a valid name nullScopedName :: ScopedName nullScopedName = makeURIScopedName nullURI 
Swish/Utils/QName.hs view
@@ -17,7 +17,7 @@ --------------------------------------------------------------------------------  -- At present we support using URI references rather than forcing an absolute--- URI. This is partly to support the existing tests (to lazy to resolve whether+-- URI. This is partly to support the existing tests (too lazy to resolve whether -- the tests really should be using relative URIs in this case).  module Swish.Utils.QName@@ -32,14 +32,12 @@     where  import System.Directory (canonicalizePath)--- import System.FilePath (splitDirectories) -import Network.URI (URI(..), URIAuth(..), parseURIReference)+import Network.URI (URI(..), URIAuth(..)+                    , parseURIReference)  import Data.String (IsString(..))--- import Data.Char (isAlpha, isAlphaNum) import Data.Maybe (fromMaybe)--- import Data.List (intercalate)  import qualified Data.Text as T @@ -62,20 +60,15 @@ may not be a good idea (space vs time saving). -} -data QName = QName-             { qnURI :: URI       -- ^ URI-             , qnNsuri :: URI     -- ^ namespace -             , qnLocal :: T.Text  -- ^ local component-             }+data QName = QName !URI URI T.Text  -- | This is not total since it will fail if the input string is not a valid URI. instance IsString QName where-  fromString s =   -    maybe (error ("Unable to convert " ++ s ++ " into a QName"))-          qnameFromURI (parseURIReference s)-+  fromString = qnameFromString+                instance Eq QName where-    (==) = qnEq+  -- see qnEq comments below+  (QName u1 _ _) == (QName u2 _ _) = u1 == u2  -- ugly, use show instance     @@ -103,6 +96,7 @@         (up2,ur2) = splitAt n u2   -}   +-- The format of show QName may well change to remove the <> instance Show QName where     show (QName u _ _) = "<" ++ show u ++ ">" @@ -118,6 +112,16 @@   let l   = T.unpack local       uristr = show ns ++ l       uri = fromMaybe (error ("Unable to parse URI from: '" ++ show ns ++ "' + '" ++ l ++ "'")) (parseURIReference uristr)+  +  {- the following does not work since the semantics of relativeTo do not match the required+     behavior here.  It may well be better to do something like the following, writing a replacement for+     relativeTo, but leave that for a later date.+  +  let l   = T.unpack local+      luri = fromMaybe (error ("Unable to parse local name as a URI reference: '" ++ l ++ "'")) (parseRelativeReference l)+      uri = fromMaybe (error ("Unable to combine " ++ show ns ++ " with " ++ l)) $ luri `relativeTo` ns+  -}+         in QName uri ns local  {-@@ -148,14 +152,25 @@            e -> error $ "Unexpected: uri=" ++ show uri ++ " has fragment='" ++ show e ++ "'"  +qnameFromString :: String -> QName+qnameFromString s =   +  maybe (error ("Unable to convert '" ++ s ++ "' into a QName"))+  qnameFromURI (parseURIReference s)++-- | Return the URI of the namespace stored in the QName.+-- This does not contain the local component.+-- getNamespace :: QName -> URI-getNamespace = qnNsuri+getNamespace (QName _ ns _) = ns +-- | Return the local component of the QName. getLocalName :: QName -> T.Text-getLocalName = qnLocal+getLocalName (QName _ _ l) = l +-- | Returns the full URI of the QName (ie the combination of the+-- namespace and local components). getQNameURI :: QName -> URI-getQNameURI = qnURI+getQNameURI (QName u _ _) = u  {- Original used comparison of concatenated strings,@@ -164,10 +179,9 @@ no longer valid with the namespace being stored as a URI, so for now just compare the overall URIs and we can optimize this at a later date if needed.--} qnEq :: QName -> QName -> Bool qnEq (QName u1 _ _) (QName u2 _ _) = u1 == u2-{-+ qnEq (QName _ n1 l1) (QName _ n2 l2) = qnEq1 n1 n2 l1 l2   where     qnEq1 (c1:ns1) (c2:ns2)  ln1 ln2   = c1==c2 && qnEq1 ns1 ns2 ln1 ln2@@ -175,18 +189,6 @@     qnEq1 ns1 []   ln1       ln2@(_:_) = qnEq1 ns1 ln2 ln1 []     qnEq1 []  []   []        []        = True     qnEq1 _   _    _         _         = False--}---- Definitions here per XML namespaces, NCName production,--- restricted to characters used in URIs.--- cf. http://www.w3.org/TR/REC-xml-names/--{--isNameStartChar :: Char -> Bool-isNameStartChar c = isAlpha c || c == '_'--isNameChar :: Char -> Bool-isNameChar      c = isAlphaNum c || c `elem` ".-_" -}  {-|
swish.cabal view
@@ -1,5 +1,5 @@ Name:               swish-Version:            0.4.0.0+Version:            0.5.0.0 Stability:          experimental License:            LGPL License-file:       LICENSE @@ -45,6 +45,11 @@   * Complete, ready-to-run, command-line and script-driven programs.   .   Changes:+  .+  [Version 0.5.0.0] The constructors for @ScopedName@ and @QName@ have been+  removed to hide some experimental optimisations (partly added in 0.4.0.0);+  @Namespace@ has seen a similar change but no optimisation. Output speed+  should be improved but no systematic analysis has been performed.   .   [Version 0.4.0.0] Moving to using polyparse for parsing and @Text@ rather than   @String@ where appropriate. Use of @URI@ and @Maybe Text@ rather than @String@ in the @Namespace@
tests/BuiltInMapTest.hs view
@@ -35,8 +35,7 @@     , getMaybeContextRule     ) -import Swish.Utils.Namespace-    ( ScopedName(..) )+import Swish.Utils.Namespace (makeNSScopedName)  import Swish.RDF.Vocabulary     ( swishName@@ -154,11 +153,11 @@ testVarMod04 = testJust "testVarMod04" $     findRDFOpenVarBindingModifier (swishName "nullVarBindingModify") testVarMod05 = testJust "testVarMod05" $-    findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "abs")+    findRDFOpenVarBindingModifier (makeNSScopedName namespaceXsdInteger "abs") testVarMod06 = testJust "testVarMod06" $-    findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "divmod")+    findRDFOpenVarBindingModifier (makeNSScopedName namespaceXsdInteger "divmod") testVarMod07 = testJust "testVarMod07" $-    findRDFOpenVarBindingModifier (ScopedName namespaceXsdInteger "ge")+    findRDFOpenVarBindingModifier (makeNSScopedName namespaceXsdInteger "ge")  testVarModSuite :: Test testVarModSuite = TestList@@ -203,11 +202,11 @@ testFindAxiom01, testFindAxiom02, testFindAxiom03 :: Test  testFindAxiom01 = testJust "testFindAxiom01" $-    getMaybeContextAxiom (ScopedName scopeRDF "a1") allRulesets+    getMaybeContextAxiom (makeNSScopedName scopeRDF "a1") allRulesets testFindAxiom02 = testJust "testFindAxiom02" $-    getMaybeContextAxiom (ScopedName scopeRDFS "a01") allRulesets+    getMaybeContextAxiom (makeNSScopedName scopeRDFS "a01") allRulesets testFindAxiom03 = testJust "testFindAxiom03" $-    getMaybeContextAxiom (ScopedName (namespaceXsdType "integer") "dt")+    getMaybeContextAxiom (makeNSScopedName (namespaceXsdType "integer") "dt")         allRulesets  testFindAxiomSuite :: Test@@ -218,13 +217,13 @@ testFindRule01, testFindRule02, testFindRule03, testFindRule04 :: Test  testFindRule01 = testJust "testFindRule01" $-    getMaybeContextRule (ScopedName scopeRDF "r1") allRulesets+    getMaybeContextRule (makeNSScopedName scopeRDF "r1") allRulesets testFindRule02 = testJust "testFindRule02" $-    getMaybeContextRule (ScopedName scopeRDFS "r1") allRulesets+    getMaybeContextRule (makeNSScopedName scopeRDFS "r1") allRulesets testFindRule03 = testJust "testFindRule03" $-    getMaybeContextRule (ScopedName scopeRDFD "r1") allRulesets+    getMaybeContextRule (makeNSScopedName scopeRDFD "r1") allRulesets testFindRule04 = testJust "testFindRule04" $-    getMaybeContextRule (ScopedName (namespaceXsdType "integer") "Abs")+    getMaybeContextRule (makeNSScopedName (namespaceXsdType "integer") "Abs")         allRulesets  testFindRuleSuite :: Test
tests/N3FormatterTest.hs view
@@ -35,7 +35,7 @@     , resOwlSameAs     ) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, makeNamespace, makeNSScopedName, namespaceToBuilder)  import Swish.Utils.LookupMap     ( LookupMap(..)@@ -81,10 +81,10 @@ toURI = fromJust . parseURI  toNS :: T.Text -> String -> Namespace-toNS p = Namespace (Just p) . toURI+toNS p = makeNamespace (Just p) . toURI  toRes :: Namespace -> T.Text -> RDFLabel-toRes ns = Res . ScopedName ns+toRes ns = Res . makeNSScopedName ns  base1, base2, base3, base4, basef, baseu, basem :: Namespace base1 = toNS "base1" "http://id.ninebynine.org/wip/2003/test/graph1/node#"@@ -127,20 +127,20 @@ c6 = Blank "c6"  p1, p2, p3, p21, p22, p23, p24, p25, p26 :: RDFLabel-p1  = Res $ ScopedName base1 "p1"-p2  = Res $ ScopedName base2 "p2"-p3  = Res $ ScopedName base3 "p3"-p21 = Res $ ScopedName base2 "p21"-p22 = Res $ ScopedName base2 "p22"-p23 = Res $ ScopedName base2 "p23"-p24 = Res $ ScopedName base2 "p24"-p25 = Res $ ScopedName base2 "p25"-p26 = Res $ ScopedName base2 "p26"+p1  = Res $ makeNSScopedName base1 "p1"+p2  = Res $ makeNSScopedName base2 "p2"+p3  = Res $ makeNSScopedName base3 "p3"+p21 = Res $ makeNSScopedName base2 "p21"+p22 = Res $ makeNSScopedName base2 "p22"+p23 = Res $ makeNSScopedName base2 "p23"+p24 = Res $ makeNSScopedName base2 "p24"+p25 = Res $ makeNSScopedName base2 "p25"+p26 = Res $ makeNSScopedName base2 "p26"  o1, o2, o3 :: RDFLabel-o1 = Res $ ScopedName base1 "o1"-o2 = Res $ ScopedName base2 "o2"-o3 = Res $ ScopedName base3 "o3"+o1 = Res $ makeNSScopedName base1 "o1"+o2 = Res $ makeNSScopedName base2 "o2"+o3 = Res $ makeNSScopedName base3 "o3"  l1txt, l2txt, l3txt, l11txt, l12txt, l13txt, l14txt :: B.Builder l1txt = "l1"@@ -165,11 +165,11 @@  lfr, lfoobar :: RDFLabel lfr = Lit "chat et chien" (Just (langName "fr"))-lfoobar = Lit "foo bar" (Just (ScopedName base1 "o1"))+lfoobar = Lit "foo bar" (Just (makeNSScopedName base1 "o1"))    f1, f2 :: RDFLabel-f1 = Res $ ScopedName base1 "f1"-f2 = Res $ ScopedName base2 "f2"+f1 = Res $ makeNSScopedName base1 "f1"+f2 = Res $ makeNSScopedName base2 "f2"  v1, v2, v3, v4 :: RDFLabel v1 = Var "var1"@@ -245,7 +245,7 @@ g1fu1 :: RDFGraph g1fu1 =   mempty-  { namespaces = makeLookupMap [basem, Namespace Nothing (toURI "file:///home/swish/photos/")]+  { namespaces = makeLookupMap [basem, makeNamespace Nothing (toURI "file:///home/swish/photos/")]   , statements = [arc sf meDepicts meMe, arc sf meHasURN su]   }   
tests/N3ParserTest.hs view
@@ -35,9 +35,10 @@     )  import Swish.Utils.Namespace (-  Namespace(..)-  , ScopedName(..)+  Namespace, makeNamespace, getNamespaceURI+  , ScopedName   , makeScopedName+  , makeNSScopedName   , nullScopedName   -- , makeUriScopedName   , namespaceToBuilder@@ -215,7 +216,7 @@ parseUriRef2Test = parseItemTest parseURIref2FromText nullScopedName  sname01 :: ScopedName-sname01  = ScopedName namespaceRDF "type"+sname01  = makeNSScopedName namespaceRDF "type"  uriRef02 :: L.Text uriRef02 = "<http://id.ninebynine.org/wip/2003/test/graph1/node#s1> "@@ -241,10 +242,10 @@ dqn = (qnameFromURI . toURI) baseFile  toNS :: T.Text -> String -> Namespace-toNS p = Namespace (Just p) . toURI+toNS p = makeNamespace (Just p) . toURI  dbase, base1, base2, base3, base4, basea :: Namespace-dbase = Namespace Nothing $ toURI "#"+dbase = makeNamespace Nothing $ toURI "#" base1 = toNS "base1" "http://id.ninebynine.org/wip/2003/test/graph1/node/" base2 = toNS "base2" "http://id.ninebynine.org/wip/2003/test/graph2/node#" base3 = toNS "base3" "http://id.ninebynine.org/wip/2003/test/graph3/node"@@ -255,28 +256,28 @@ xsdNS = toNS "xsd" "http://www.w3.org/2001/XMLSchema#"  u1 :: RDFLabel-u1 = Res $ ScopedName base1 ""+u1 = Res $ makeNSScopedName base1 ""  ds1, ds2, ds3 :: RDFLabel-ds1 = Res $ ScopedName dbase "s1"-ds2 = Res $ ScopedName dbase "s2"-ds3 = Res $ ScopedName dbase "s3"+ds1 = Res $ makeNSScopedName dbase "s1"+ds2 = Res $ makeNSScopedName dbase "s2"+ds3 = Res $ makeNSScopedName dbase "s3"  dp1, dp2, dp3 :: RDFLabel-dp1 = Res $ ScopedName dbase "p1"-dp2 = Res $ ScopedName dbase "p2"-dp3 = Res $ ScopedName dbase "p3"+dp1 = Res $ makeNSScopedName dbase "p1"+dp2 = Res $ makeNSScopedName dbase "p2"+dp3 = Res $ makeNSScopedName dbase "p3"  do1, do2, do3 :: RDFLabel-do1 = Res $ ScopedName dbase "o1"-do2 = Res $ ScopedName dbase "o2"-do3 = Res $ ScopedName dbase "o3"+do1 = Res $ makeNSScopedName dbase "o1"+do2 = Res $ makeNSScopedName dbase "o2"+do3 = Res $ makeNSScopedName dbase "o3"  s1, s2, s3, sa :: RDFLabel-s1 = Res $ ScopedName base1 "s1"-s2 = Res $ ScopedName base2 "s2"-s3 = Res $ ScopedName base3 "s3"-sa = Res $ ScopedName basea "a"+s1 = Res $ makeNSScopedName base1 "s1"+s2 = Res $ makeNSScopedName base2 "s2"+s3 = Res $ makeNSScopedName base3 "s3"+sa = Res $ makeNSScopedName basea "a"  b1, b2, b3, b4, b5, b6, b7, b8 :: RDFLabel b1 = Blank "b1"@@ -297,16 +298,16 @@ c6 = Blank "c6"  p1, p2, p3, pa :: RDFLabel-p1 = Res $ ScopedName base1 "p1" -p2 = Res $ ScopedName base2 "p2" -p3 = Res $ ScopedName base3 "p3" -pa = Res $ ScopedName basea "b" +p1 = Res $ makeNSScopedName base1 "p1" +p2 = Res $ makeNSScopedName base2 "p2" +p3 = Res $ makeNSScopedName base3 "p3" +pa = Res $ makeNSScopedName basea "b"   o1, o2, o3, oa :: RDFLabel-o1 = Res $ ScopedName base1 "o1"-o2 = Res $ ScopedName base2 "o2"-o3 = Res $ ScopedName base3 "o3"-oa = Res $ ScopedName basea "c"+o1 = Res $ makeNSScopedName base1 "o1"+o2 = Res $ makeNSScopedName base2 "o2"+o3 = Res $ makeNSScopedName base3 "o3"+oa = Res $ makeNSScopedName basea "c"  l1, l2, l3 :: RDFLabel l1 = Lit "l1"  Nothing@@ -323,8 +324,8 @@ bFalse = Lit "false" $ Just xsdBoolean  f1, f2 :: RDFLabel-f1 = Res $ ScopedName base1 "f1"-f2 = Res $ ScopedName base2 "f2" +f1 = Res $ makeNSScopedName base1 "f1"+f2 = Res $ makeNSScopedName base2 "f2"   v1, v2, v3, v4 :: RDFLabel v1 = Var "var1"@@ -347,7 +348,7 @@ t07  = arc s3 p2 l3  makeNewPrefixNamespace :: (T.Text,Namespace) -> Namespace-makeNewPrefixNamespace (pre,ns) = Namespace (Just pre) (nsURI ns)+makeNewPrefixNamespace (pre,ns) = makeNamespace (Just pre) (getNamespaceURI ns)  dg1, dg2, dg3 :: RDFGraph dg1 = toRDFGraph [arc ds1 dp1 do1]@@ -370,9 +371,9 @@     xb3 = Res "http://example.org/ns/foo/b3"     xc3 = Res "http://example.org/ns/foo/c3"     -    ns4 = Namespace Nothing $ toURI "http://example.org/ns/foo/bar#"-    ns5 = Namespace Nothing $ toURI "http://example.org/ns2#"-    mUN a b = Res (ScopedName a b)+    ns4 = makeNamespace Nothing $ toURI "http://example.org/ns/foo/bar#"+    ns5 = makeNamespace Nothing $ toURI "http://example.org/ns2#"+    mUN a b = Res (makeNSScopedName a b)     xa4 = mUN ns4 "a4"     xb4 = mUN ns4 "b4"     xc4 = mUN ns4 "c4"@@ -809,7 +810,7 @@       [ arc b a c ]   where     -- the document base is set to file:///dev/null to begin with-    mUN = Res . ScopedName dbase+    mUN = Res . makeNSScopedName dbase     a = mUN "a"     b = mUN "b"     c = mUN "c"@@ -878,7 +879,7 @@   "a:a a:b a:c ."  nToB :: Namespace -> B.Builder-nToB = B.fromString . show . nsURI+nToB = B.fromString . show . getNamespaceURI  --  Single statement using :name form simpleN3Graph_g1_03 :: B.Builder
tests/NTTest.hs view
@@ -88,7 +88,7 @@ -- --  This is the contents of --    http://www.w3.org/2000/10/rdf-tests/rdfcore/ntriples/test.nt---  retrived on 2011-03-23 11:25:46+--  retrieved on 2011-03-23 11:25:46 -- ------------------------------------------------------------ 
tests/QNameTest.hs view
@@ -332,7 +332,7 @@ testSQRoundTrip lbl uri =    let u = (fromJust . parseURIReference) uri       qn = qnameFromURI u-      sn = makeQNameScopedName qn+      sn = makeQNameScopedName Nothing qn   in TestList      [ testIsEq "SQ:URI"   lbl u  (getScopedNameURI sn)      , testIsEq "SQ:Qname" lbl qn (getQName sn)
tests/RDFDatatypeXsdIntegerTest.hs view
@@ -51,7 +51,7 @@ import Swish.RDF.Ruleset (Ruleset(..), getRulesetRule) import Swish.RDF.Rule    (Formula(..), Rule(..), nullFormula, nullRule) import Swish.RDF.VarBinding (makeVarBinding)-import Swish.Utils.Namespace (Namespace(..), ScopedName(..), makeScopedName)+import Swish.Utils.Namespace (getNamespaceURI, ScopedName, makeScopedName, makeNSScopedName) import Swish.RDF.Vocabulary (namespaceDefault) import Swish.Utils.LookupMap (LookupMap(..), mapFindMaybe) import Swish.Utils.ListHelpers (equiv)@@ -162,7 +162,7 @@ toURI = fromJust . parseURI  xsdIntName :: T.Text -> ScopedName-xsdIntName = ScopedName namespaceXsdInteger +xsdIntName = makeNSScopedName namespaceXsdInteger   axiomXsdIntegerDT :: ScopedName axiomXsdIntegerDT       = xsdIntName "dt"@@ -829,7 +829,7 @@ mkGraph :: B.Builder -> RDFGraph mkGraph gr =    let base = "@prefix : <" `mappend` (ns `mappend` "> . \n")-      ns = B.fromString $ show $ nsURI namespaceDefault+      ns = B.fromString $ show $ getNamespaceURI namespaceDefault   in makeRDFGraphFromN3Builder (prefixXsdInteger `mappend` (base `mappend` gr))  testRuleFwd :: String -> Maybe (Rule RDFGraph) -> B.Builder -> [B.Builder] -> Test@@ -1149,10 +1149,10 @@  pvRule0, pvRule1 :: Maybe (Rule RDFGraph) pvRule0 = mapFindMaybe-            (ScopedName namespaceDefault "PassengerVehicle")+            (makeNSScopedName namespaceDefault "PassengerVehicle")             (LookupMap pvRules) pvRule1 = mapFindMaybe-            (ScopedName namespaceDefault "PassengerVehicle1")+            (makeNSScopedName namespaceDefault "PassengerVehicle1")             (LookupMap pvRules)  pv01inp :: B.Builder
tests/RDFGraphTest.hs view
@@ -26,7 +26,7 @@  import Swish.RDF.GraphClass (Label(..), arc) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), nullScopedName)+import Swish.Utils.Namespace (Namespace, makeNamespace, getNamespaceURI, ScopedName, makeNSScopedName, nullScopedName) import Swish.Utils.QName (QName, qnameFromURI)  import Swish.RDF.RDFGraph@@ -152,15 +152,15 @@ toURI s = fromMaybe (error $ "Error: unable to parse URI " ++ s) (parseURI s)  toNS :: T.Text -> String -> Namespace-toNS p = Namespace (Just p) . toURI+toNS p = makeNamespace (Just p) . toURI  -- TODO: basee and baseu had prefixes of "" and "?" before the conversion --       to using Maybe String. Now both are Nothing; is this semantically --       correct? Probably.  basee, baseu, base1, base2, base3, base4 :: Namespace-basee = Namespace Nothing $ toURI "http://example.com/a#"-baseu = Namespace Nothing $ toURI "http://example.com/"+basee = makeNamespace Nothing $ toURI "http://example.com/a#"+baseu = makeNamespace Nothing $ toURI "http://example.com/" base1 = toNS "base1" base1Str base2 = toNS "base2" "http://id.ninebynine.org/wip/2003/test/graph2/node/" base3 = toNS "base3" "http://id.ninebynine.org/wip/2003/test/graph3/node"@@ -173,14 +173,14 @@ qu1s1 = toURI $ base1Str ++ "s1"  qbes1, qbus1, qb1s1, qb2s2, qb3s3, qb3, qb3bm, qb4m :: ScopedName-qbes1 = ScopedName basee "s1"-qbus1 = ScopedName baseu "s1"-qb1s1 = ScopedName base1 "s1"-qb2s2 = ScopedName base2 "s2"-qb3s3 = ScopedName base3 "s3"-qb3   = ScopedName base3 ""-qb3bm = ScopedName base3 "basemore"-qb4m  = ScopedName base4 "more"+qbes1 = makeNSScopedName basee "s1"+qbus1 = makeNSScopedName baseu "s1"+qb1s1 = makeNSScopedName base1 "s1"+qb2s2 = makeNSScopedName base2 "s2"+qb3s3 = makeNSScopedName base3 "s3"+qb3   = makeNSScopedName base3 ""+qb3bm = makeNSScopedName base3 "basemore"+qb4m  = makeNSScopedName base4 "more"  es1, us1, s1, s2, s3, s4, s5, s6, s7, s8 :: RDFLabel es1 = Res qbes1@@ -195,9 +195,9 @@ s8 = Blank "s8"  st1, st2, st3 :: RDFLabel-st1 = toRDFLabel $ ScopedName base1 "st1"-st2 = toRDFLabel $ ScopedName base2 "st2" -st3 = toRDFLabel $ ScopedName base3 "st3"+st1 = toRDFLabel $ makeNSScopedName base1 "st1"+st2 = toRDFLabel $ makeNSScopedName base2 "st2" +st3 = toRDFLabel $ makeNSScopedName base3 "st3"  bb, bb0, b1, b2, b3, b4, b5, b6, b7,   b8, b9, b10 :: RDFLabel@@ -233,22 +233,22 @@ bn6 = Blank "6"  p1, p2, p3, p4 :: RDFLabel-p1 = Res $ ScopedName base1 "p1"-p2 = Res $ ScopedName base2 "p2"-p3 = Res $ ScopedName base3 "p3"-p4 = Res $ ScopedName base3 "p4"+p1 = Res $ makeNSScopedName base1 "p1"+p2 = Res $ makeNSScopedName base2 "p2"+p3 = Res $ makeNSScopedName base3 "p3"+p4 = Res $ makeNSScopedName base3 "p4"  o1, o2, o3, o4, o5, o6 :: RDFLabel-o1 = Res $ ScopedName base1 "o1"-o2 = Res $ ScopedName base2 "o2"-o3 = Res $ ScopedName base3 "o3"+o1 = Res $ makeNSScopedName base1 "o1"+o2 = Res $ makeNSScopedName base2 "o2"+o3 = Res $ makeNSScopedName base3 "o3" o4 = toRDFLabel qb3    o5 = Blank "o5" o6 = Blank "s5"  qb1t1, qb1t2 :: ScopedName-qb1t1 = ScopedName base1 "type1"-qb1t2 = ScopedName base1 "type2"+qb1t1 = makeNSScopedName base1 "type1"+qb1t2 = makeNSScopedName base1 "type2"  l1, l2, l2gb, l3, l4, l5, l6, l7, l8,   l9, l10, l11, l12 :: RDFLabel@@ -289,10 +289,10 @@ -- Test cases for isMemberProp  cm1, cm2, nm1, nm2 :: RDFLabel-cm1  = Res $ ScopedName namespaceRDF "_1"-cm2  = Res $ ScopedName namespaceRDF "_234567"-nm1  = Res $ ScopedName namespaceRDF "987"-nm2  = Res $ ScopedName namespaceRDF "_987a65"+cm1  = Res $ makeNSScopedName namespaceRDF "_1"+cm2  = Res $ makeNSScopedName namespaceRDF "_234567"+nm1  = Res $ makeNSScopedName namespaceRDF "987"+nm2  = Res $ makeNSScopedName namespaceRDF "_987a65"  ------------------------------------------------------------ --  RDFLabel construction and equality tests@@ -852,7 +852,7 @@ tt06 = arc st3 p1 l10  makeNewPrefixNamespace :: (T.Text,Namespace) -> Namespace-makeNewPrefixNamespace (pre,ns) = Namespace (Just pre) (nsURI ns)+makeNewPrefixNamespace (pre,ns) = makeNamespace (Just pre) (getNamespaceURI ns)  nslist :: LookupMap Namespace nslist = LookupMap $ map makeNewPrefixNamespace
tests/RDFProofContextTest.hs view
@@ -34,7 +34,7 @@ import Swish.RDF.Ruleset (getContextAxiom, getContextRule) import Swish.RDF.Rule (Formula(..), Rule(..), nullFormula, nullRule) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName, makeNSScopedName, namespaceToBuilder) import Swish.Utils.LookupMap (mapFindMaybe)  import Swish.RDF.Vocabulary@@ -119,7 +119,7 @@ getAxiom nam = getContextAxiom (makeSName nam) nullRDFFormula rdfdContext  makeSName :: String -> ScopedName-makeSName nam = ScopedName ns (T.pack loc)+makeSName nam = makeNSScopedName ns (T.pack loc)     where         (pre,_:loc) = break (==':') nam         ns = case pre of@@ -136,7 +136,7 @@ toURI = fromJust . parseURI  toNS :: Maybe T.Text -> String -> Namespace-toNS p = Namespace p . toURI+toNS p = makeNamespace p . toURI  mkPrefix :: Namespace -> B.Builder mkPrefix = namespaceToBuilder@@ -526,7 +526,7 @@  rdfAxiomIntDt :: RDFFormula rdfAxiomIntDt = getContextAxiom-                    (ScopedName (namespaceXsdType "integer") "dt")+                    (makeNSScopedName (namespaceXsdType "integer") "dt")                     nullFormula                     allRulesets @@ -594,7 +594,7 @@  rdfAxiomStrDt :: RDFFormula rdfAxiomStrDt = getContextAxiom-                    (ScopedName (namespaceXsdType "string") "dt")+                    (makeNSScopedName (namespaceXsdType "string") "dt")                     nullFormula                     allRulesets 
tests/RDFProofTest.hs view
@@ -50,7 +50,7 @@     )  import Swish.RDF.Rule (Rule(..))-import Swish.Utils.Namespace (Namespace(..), ScopedName(..))+import Swish.Utils.Namespace (Namespace, makeNamespace, ScopedName, makeNSScopedName)  import Test.HUnit     ( Test(TestCase,TestList)@@ -103,7 +103,7 @@ toURI = fromJust . parseURI  toNS :: Maybe T.Text -> String -> Namespace-toNS p = Namespace p . toURI+toNS p = makeNamespace p . toURI  --  test1:  simple query with URI, literal and blank nodes. @@ -660,7 +660,7 @@ vocab4 = allNodes (not . labelIsVar) graph4  name4 :: ScopedName-name4 = ScopedName scope4 "instance4"+name4 = makeNSScopedName scope4 "instance4"  rule4 :: RDFRule rule4 = makeRdfInstanceEntailmentRule name4 vocab4@@ -847,7 +847,7 @@          ]  name5 :: ScopedName-name5 = ScopedName scope5 "subgraph5"+name5 = makeNSScopedName scope5 "subgraph5"  rule5 :: RDFRule rule5 = makeRdfSubgraphEntailmentRule name5@@ -916,7 +916,7 @@          ]  name6 :: ScopedName-name6 = ScopedName scope5 "subgraph6"+name6 = makeNSScopedName scope5 "subgraph6"  rule6 :: RDFRule rule6 = makeRdfSimpleEntailmentRule name6
tests/RDFQueryTest.hs view
@@ -53,7 +53,7 @@     , varFilterNE     ) -import Swish.Utils.Namespace (Namespace(..), ScopedName(..), makeScopedName)+import Swish.Utils.Namespace (getNamespaceURI, ScopedName, makeScopedName) import Swish.RDF.Vocabulary (namespaceRDF, langName, swishName, rdfType, rdfXMLLiteral) import Swish.RDF.N3Parser (parseN3) import Swish.Utils.ListHelpers (equiv)@@ -1282,7 +1282,7 @@ baseex = toURI "http://example.org/"  baserdf :: URI-baserdf  = nsURI namespaceRDF+baserdf  = getNamespaceURI namespaceRDF  q_dattyp :: ScopedName q_dattyp = makeScopedName Nothing baseex "datatype"
tests/RDFRulesetTest.hs view
@@ -55,7 +55,7 @@  import Swish.RDF.Rule (Formula(..), Rule(..), fwdCheckInference ) import Swish.RDF.Vocabulary (namespaceRDF, namespaceRDFS, namespaceOWL, scopeRDF)-import Swish.Utils.Namespace (Namespace(..), ScopedName(..), makeScopedName, namespaceToBuilder)+import Swish.Utils.Namespace (Namespace, makeNamespace, getNamespaceTuple, getNamespaceURI, ScopedName, makeScopedName, makeNSScopedName, namespaceToBuilder)  import Test.HUnit     ( Test(TestCase,TestList)@@ -104,10 +104,8 @@ testSameNamespace lab n1 n2 =     TestCase ( assertBool ("testSameNamespace:"++lab) ((p1==p2)&&(u1==u2)) )     where-        p1 = nsPrefix n1-        p2 = nsPrefix n2-        u1 = nsURI n1-        u2 = nsURI n2+      (p1, u1) = getNamespaceTuple n1+      (p2, u2) = getNamespaceTuple n2  testScopedNameEq :: String -> Bool -> ScopedName -> ScopedName -> Test testScopedNameEq lab eq n1 n2 =@@ -135,14 +133,14 @@ ------------------------------------------------------------  pref_rdf, pref_owl :: URI-pref_rdf = nsURI namespaceRDF-pref_owl = nsURI namespaceOWL+pref_rdf = getNamespaceURI namespaceRDF+pref_owl = getNamespaceURI namespaceOWL  toURI :: String -> URI toURI = fromJust . parseURI  toNS :: Maybe T.Text -> String -> Namespace-toNS p = Namespace p . toURI+toNS p = makeNamespace p . toURI  ------------------------------------------------------------ --  Define and manipulate rulesets@@ -228,15 +226,15 @@   , testSameAxioms    "testAX01" a1s (getRulesetAxioms r1)   , testSameRules     "testRU01" r1s (getRulesetRules r1)   , testEqual "testGeta11" (Just a11) $-      getRulesetAxiom (ScopedName rn1 "a11") r1+      getRulesetAxiom (makeNSScopedName rn1 "a11") r1   , testEqual "testGeta11" (Just a12) $-      getRulesetAxiom (ScopedName rn1 "a12") r1+      getRulesetAxiom (makeNSScopedName rn1 "a12") r1   , testEqual "testGetr11" (Just r11) $-      getRulesetRule (ScopedName rn1 "r11") r1+      getRulesetRule (makeNSScopedName rn1 "r11") r1   , testEqual "testGetr12" (Just r12) $-      getRulesetRule (ScopedName rn1 "r12") r1+      getRulesetRule (makeNSScopedName rn1 "r12") r1   , testEqual "testGetnone" Nothing $-      getRulesetRule (ScopedName rn1 "none") r1+      getRulesetRule (makeNSScopedName rn1 "none") r1   ]  ------------------------------------------------------------@@ -273,7 +271,7 @@  rdfr2grc :: RDFClosure  rdfr2grc = GraphClosure-            { nameGraphRule = ScopedName scopeRDF "r2"+            { nameGraphRule = makeNSScopedName scopeRDF "r2"             , ruleAnt       = getArcs rdfr2ant             , ruleCon       = getArcs rdfr2con             , ruleModify    = fromJust rdfr2modc