[Fencommits] fenfire-hs: From/ToRDF combinators for getting and adding single properties

Benja Fallenstein benja.fallenstein at gmail.com
Thu Apr 5 18:56:35 EEST 2007


Thu Apr  5 18:56:02 EEST 2007  Benja Fallenstein <benja.fallenstein at gmail.com>
  * From/ToRDF combinators for getting and adding single properties
diff -rN -u old-fenfire-hs/Fenfire/RDF.hs new-fenfire-hs/Fenfire/RDF.hs
--- old-fenfire-hs/Fenfire/RDF.hs	2007-04-05 18:56:34.000000000 +0300
+++ new-fenfire-hs/Fenfire/RDF.hs	2007-04-05 18:56:34.000000000 +0300
@@ -317,6 +317,12 @@
           -> ((a,b) -> ToRdfM Node)
 toRDFPair p1 f1 p2 f2 (x,y) =
     do n <- newBNode; addRDFPair p1 f1 p2 f2 (x,y) n; return n
+    
+fromRDFConn :: Node -> FromRdfM a -> FromRdfM a
+fromRDFConn p f g n = query (n, p, X) g >>= f g
+
+addRDFConn :: Node -> (a -> ToRdfM Node) -> a -> Node -> ToRdfM ()
+addRDFConn p f x n = do n' <- f x; tellTs [(n,p,n')]
                                  
 fromRDFConns :: Node -> FromRdfM a -> FromRdfM [a]
 fromRDFConns p f g n = mapM (f g) $ query (n, p, X) g




More information about the Fencommits mailing list