A quick and dirty solution
What I meant with my comment is something like the following:
Use the set of parsed data structures you have and simplify them a bit (e.g. with regexes)
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4707" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#op_0" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4777"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4707" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4776"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4707" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#addr_expr"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4707" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://www.w3.org/2002/07/owl#NamedIndividual"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4706" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#op_0" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#5578"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4706" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#40"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4706" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#nop_expr"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4706" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://www.w3.org/2002/07/owl#NamedIndividual"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4705" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#int" LNode plainl2 "619"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4705" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#93"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4705" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#integer_cst"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4705" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://www.w3.org/2002/07/owl#NamedIndividual"
Triple "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#4704" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#op_0" "https://h4ck3rm1k3.github.io/gogccintro/gcc/ontology/2017/05/20/gcc_compiler.owl#5577"
Then write a small parser for your testdata (i know this is incomplete and you might have to tweak this code snippet)
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad (void)
import qualified Data.Text as T
import Data.Text (Text)
import Data.Attoparsec.Text as AT
import qualified Data.Text.IO as TIO
data Triple = Triple Text Text Text
triple :: Parser Triple
triple = do void $ string "Triple"
skipSpace
let entry = char '"' *> AT.takeWhile (/= '"') <* char '"'
a <- entry
skipSpace
b <- entry
skipSpace
c <- entry
return $ Triple a b c
main :: IO ()
main = do triples <- map (parseOnly triple) . T.lines <$> TIO.readFile "Libdata.hs"
print $ length [x | Right x <- triples]
this script runs with stack runhaskell Main.hs
in a bit more than a second - fast enough to use it in say automated testing at each save.
A thorough solution
When reading your comments - I think this is somewhat of an XY problem - you want to put data inside your application (I guess for test purposes) because rdf4h is too slow. Taking a glance at the library - it uses parsec - whereas attoparsec would be faster. Saying this I see that you have already filed an issue at github.
What you could also do is clone the git-repo - add a automatic read instance and read
the data structure you have successfully parsed and show
n.