Portability | OverloadedStrings |
---|---|
Stability | experimental |
Maintainer | Douglas Burke |
Safe Haskell | None |
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 Working Draft 09 August 2011 (http://www.w3.org/TR/2011/WD-turtle-20110809/), http://www.w3.org/TR/turtle/
NOTES:
- At present there is a lot of overlap with the N3 Parser.
- The parser needs to be updated to the latest working draft (10 July 2012, http://www.w3.org/TR/2012/WD-turtle-20120710/#sec-changelog).
- Strings with no language tag are converted to a
LitTag
not aTypedLitTag
with a type ofxsd: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.
- type ParseResult = Either String RDFGraph
- parseTurtle :: Text -> Maybe URI -> ParseResult
- parseTurtlefromText :: Text -> ParseResult
Documentation
type ParseResult = Either String RDFGraphSource
The result of a parse, which is either an error message or a graph.
:: 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.
:: Text | input in N3 format. |
-> ParseResult |
Parse as Turtle (with no real base URI).
See parseTurtle
if you need to provide a base URI.