swish-0.9.1.7: A semantic web toolkit.

Copyright | (c) 2003, Graham Klyne, 2009 Vasili I Galchin, 2011, 2012, 2013, 2014 Douglas Burke
License | GPL V2
Maintainer | Douglas Burke
Stability | experimental
Portability | OverloadedStrings
Safe Haskell | None
Language | Haskell98

Swish.RDF.Parser.Turtle

Description

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.

REFERENCES:

- "Turtle, Terse RDF Triple Language", W3C Candidate Recommendation 19 February 2013 (<http://www.w3.org/TR/2013/CR-turtle-20130219/L), http://www.w3.org/TR/turtle/

NOTES:

- Prior to version `0.9.0.4`, 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`.

Synopsis

- type ParseResult = Either String RDFGraph
- parseTurtle :: Text -> Maybe URI -> ParseResult
- parseTurtlefromText :: Text -> ParseResult

# Documentation

type ParseResult = Either String RDFGraph Source

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

parseTurtle Source

Arguments

:: 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

Arguments

:: Text | input in N3 format.
-> ParseResult |

Parse as Turtle (with no real base URI).

See `parseTurtle` if you need to provide a base URI.