Copyright | (c) 2003 Graham Klyne 2009 Vasili I Galchin 2011 2012 2013 2014 2018 2020 2022 Douglas Burke |
---|---|
License | GPL V2 |
Maintainer | Douglas Burke |
Stability | experimental |
Portability | CPP, DerivingStrategies, OverloadedStrings |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 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. - 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
, andlocalName_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.
:: 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.