Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid RDF format when writing to file #105

Open
koslambrou opened this issue Jan 3, 2021 · 0 comments
Open

Invalid RDF format when writing to file #105

koslambrou opened this issue Jan 3, 2021 · 0 comments

Comments

@koslambrou
Copy link
Contributor

Problem: Invalid Turtle RDF when writing to file.

Sample code:

{-# LANGUAGE OverloadedStrings          #-}

module Main where

import Data.RDF
import           Text.RDF.RDF4H.TurtleParser
import           Text.RDF.RDF4H.TurtleSerializer
import System.Exit
import qualified Data.Map as Map
import qualified Data.Text as Text
import System.IO

main = do
  writeRdfToFileTest

writeRdfToFileTest = do
  let t1 = Triple (unode "/void/Dataset") (unode "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") (unode "http://rdfs.org/ns/void#DatasetDescription")
  let triples = [t1]
  let graph = mkRdf triples Nothing (PrefixMappings Map.empty) :: RDF TList

  let graphFpath = Text.unpack "rdftest.ttl"
  withFile
    graphFpath
    WriteMode
    (\h -> hWriteRdf (TurtleSerializer Nothing (prefixMappings graph)) h graph)

Actual file content:

/void/Dataset <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/ns/void#DatasetDescription> .

This is invalid Turtle syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant