swish- A semantic web toolkit.

Copyright(c) 2003 Graham Klyne 2009 Vasili I Galchin 2011 2012 2013 2014 2018 Douglas Burke
LicenseGPL V2
MaintainerDouglas Burke
PortabilityCPP, OverloadedStrings
Safe HaskellNone



This Module implements a Turtle parser, returning a new RDFGraph consisting of triples and namespace information parsed from the supplied input string, or an error indication.



  • Prior to version, the parser followed the W3C Working Draft 09 August 2011 (http://www.w3.org/TR/2011/WD-turtle-20110809/)
  • Strings with no language tag are converted to a LitTag not a TypedLitTag with a type of xsd:string (e.g. see http://www.w3.org/TR/2011/WD-turtle-20110809/#terms).
  • If the URI is actually an IRI (Internationalized Resource Identifiers) then the parser will fail since parseURI fails.
  • The current (August 2013) Turtle test suite from http://www.w3.org/2013/TurtleTests/ passes except for the four tests with non-ASCII local names, namely: localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries, localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries, localName_with_nfc_PN_CHARS_BASE_character_boundaries, and localName_with_non_leading_extras.


type ParseResult = Either String RDFGraph Source #

The result of a parse, which is either an error message or a graph.

parseTurtle Source #


:: Text

input in N3 format.

-> Maybe URI

optional base URI

-> ParseResult 

Parse a string with an optional base URI.

Unlike parseN3 we treat the base URI as a URI and not a QName.

parseTurtlefromText Source #


:: Text

input in N3 format.

-> ParseResult 

Parse as Turtle (with no real base URI).

See parseTurtle if you need to provide a base URI.