Portability | H98 |
---|---|
Stability | experimental |
Maintainer | Douglas Burke |
This Module implements a Notation 3 parser (see [1], [2], [3]), returning a
new RDFGraph
consisting of triples and namespace information parsed from
the supplied N3 input string, or an error indication.
Uses the Parsec monadic parser library.
REFERENCES:
1 http://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/ Notation3 (N3): A readable RDF syntax, W3C Team Submission 14 January 2008
2 http://www.w3.org/DesignIssues/Notation3.html Tim Berners-Lee's design issues series notes and description
3 http://www.w3.org/2000/10/swap/Primer.html Notation 3 Primer by Sean Palmer
NOTES:
UTF-8 handling is not really tested.
No performance testing has been applied.
Not all N3 grammar elements are supported, including:
-
@forSome
(we read it in but ignore the arguments) -
@forAll
(this causes a parse error) - formulae are lightly tested
- string support is incomplete (e.g. unrecognized escape characters
such as
\q
are probably handled incorrectly)
- type ParseResult = Either String RDFGraph
- parseN3 :: String -> Maybe QName -> ParseResult
- parseN3fromString :: String -> ParseResult
- parseAnyfromString :: N3Parser a -> Maybe QName -> String -> Either String a
- parseTextFromString :: String -> String -> Either String String
- parseAltFromString :: String -> String -> String -> Either String String
- parseNameFromString :: String -> Either String String
- parsePrefixFromString :: String -> Either String Namespace
- parseAbsURIrefFromString :: String -> Either String String
- parseLexURIrefFromString :: String -> Either String String
- parseURIref2FromString :: String -> Either String ScopedName
- type N3Parser a = RDFParser N3State a
- data N3State = N3State {}
- type SpecialMap = LookupMap (String, ScopedName)
- whiteSpace :: N3Parser ()
- symbol :: String -> N3Parser String
- lexeme :: N3Parser a -> N3Parser a
- eof :: Show tok => GenParser tok st ()
- identStart :: CharParser st Char
- identLetter :: CharParser st Char
- getPrefix :: N3Parser ()
- n3symbol :: N3Parser ScopedName
- quickVariable :: N3Parser RDFLabel
- lexUriRef :: N3Parser String
- document :: N3Parser RDFGraph
- subgraph :: RDFLabel -> N3Parser RDFGraph
- newBlankNode :: N3Parser RDFLabel
Documentation
type ParseResult = Either String RDFGraphSource
:: String | input in N3 format. |
-> Maybe QName | optional base URI |
-> ParseResult |
Parse a string with an optional base URI.
See also parseN3fromString
.
:: String | input in N3 format. |
-> ParseResult |
Parse a string as N3 (with no real base URI).
See parseN3
if you need to provide a base URI.
:: N3Parser a | parser to apply |
-> Maybe QName | base URI of the input, or |
-> String | input to be parsed |
-> Either String a |
Function to supply initial context and parse supplied term.
We augment the Parsec error with the context.
Exports for parsers that embed Notation3 in a bigger syntax
N3 parser state
N3State | |
|
type SpecialMap = LookupMap (String, ScopedName)Source
Type for special name lookup table
identStart :: CharParser st CharSource
identLetter :: CharParser st CharSource