[Fencommits] fenfire-hs: Fix base URI when loading hash URIs

Tuukka Hastrup Tuukka.Hastrup at iki.fi
Tue Apr 22 01:52:32 EEST 2008


Tue Apr 22 01:12:19 EEST 2008  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * Fix base URI when loading hash URIs

    M ./Fenfire.fhs -4 +5

Tue Apr 22 01:12:19 EEST 2008  Tuukka Hastrup <Tuukka.Hastrup at iki.fi>
  * Fix base URI when loading hash URIs
diff -rN -u old-fenfire-hs-1/Fenfire.fhs new-fenfire-hs-1/Fenfire.fhs
--- old-fenfire-hs-1/Fenfire.fhs	2008-04-22 01:52:32.173466000 +0300
+++ new-fenfire-hs-1/Fenfire.fhs	2008-04-22 01:52:32.173466000 +0300
@@ -258,12 +258,13 @@
 loadGraph :: FilePath -> IO Graph
 loadGraph fileName = 
     if List.isPrefixOf "http:" fileName
-        then    loadGraph' (Raptor.uriToTriples fileName) fileName
+        then do let document = takeWhile (/='#') fileName -- FIXME redirects!
+                loadGraph' (Raptor.uriToTriples fileName) document
         else do uri <- Raptor.filenameToURI fileName
                 loadGraph' (Raptor.filenameToTriples fileName) uri
-    where loadGraph' load' uri = do
-              (triples, namespaces) <- load' Nothing
-              return $ raptorToGraph triples namespaces (takeWhile (/='#') uri)
+    where loadGraph' load' baseuri = do
+              (triples, namespaces) <- load' (Just baseuri)
+              return $ raptorToGraph triples namespaces baseuri
 
 saveGraph :: Graph -> FilePath -> IO ()
 saveGraph graph fileName = do




More information about the Fencommits mailing list