Open stgit opened 13 years ago
Hey. It's good to know someone is interested :). I should have some time to generate a proper readme over the weekend (likely tomorrow). I hope that's early enough for your purposes.
Hey. Looking forward to the README file. Is the most resent version of the code actually on github or in the darcs repository? I managed to hack some code together to open a turtle rdf file and to run a query. Is really hacked code, as you can see:
instance Show TriplesGraph where show gr = concatMap (\t -> show t ++ "\n") (queryClasses gr)
rdffile :: String
rdffile = "/home/steve/Develop/myhaskell/myrdf/bookmarks.ttl"
main :: IO ()
main = do loadInputGraph rdffile >>= putStrLn . show
query'' :: TriplesGraph -> Maybe Subject -> Maybe Predicate -> Maybe Object -> Triples
query'' gr s p o = removeDupes $ filter (matchPattern s p o) (triplesOf gr)
queryClasses :: TriplesGraph -> Triples
queryClasses gr = query'' gr Nothing Nothing (Just (unode (s2b "http://www.w3.org/2002/07/owl#Class")) )
loadInputGraph :: String -> IO (Either ParseFailure TriplesGraph)
loadInputGraph name =
B.readFile (name) >>=
return . parseString (TurtleParser mtestBaseUri (mkDocUrl testBaseUri name)) >>= return . handleLoad
What would be the right way to run a query from main::IO?
From what I seen so far the source code of RDF4H is VERY readable and nice!!
Hi
RDF4H is really great!!! People use it ;-)
Could you possibly provide an example? Like a few lines where you read a turtle rdf file and make a simple query on it? I am trying to figure it out myself but it takes some hours for me. (also since I am not ye fully familiar with haskell...)
For ghc 7.0.3 I needed to fix the ".cabal" file to get it working. I did the following changes (just guessed what might work, so not sure):
Her is the diff for "rdf4h.cabal":