From 11e83528df0f4e48d9324b2e4dd82dc58792fb16 Mon Sep 17 00:00:00 2001 From: defanor Date: Tue, 23 Jan 2018 15:28:05 +0300 Subject: Add initial RDF support With two types of caching: file-based for retrieved documents, and memory-based for predicate labels extracted from those. --- Pancake/Common.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Pancake/Common.hs') diff --git a/Pancake/Common.hs b/Pancake/Common.hs index ee21ab3..d107a02 100644 --- a/Pancake/Common.hs +++ b/Pancake/Common.hs @@ -24,9 +24,11 @@ Portability : portable Utility functions. -} -module Pancake.Common ( putErrLn ) where +module Pancake.Common ( putErrLn, escapeURI ) where import System.IO import Control.Monad.IO.Class +import Network.URI +import System.FilePath -- | Prints a line into stderr. @@ -34,3 +36,10 @@ putErrLn :: MonadIO m => String -> m () putErrLn s = liftIO $ do hPutStrLn stderr s hFlush stderr + +-- | Escapes an URI for use as a file name. +escapeURI :: URI -> FilePath +escapeURI u = map escapeChar $ uriToString id u "" + where escapeChar c + | isPathSeparator c = '-' + | otherwise = c -- cgit v1.2.3