parser_ttl.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _LSUP_TTL_PARSER_H
  2. #define _LSUP_TTL_PARSER_H
  3. #include "codec.h"
  4. // Parser interface. Required because Lemon doesn't export these in the header
  5. // automatically.
  6. /*
  7. void *TTLParseAlloc( void*(*malloc)(size_t));
  8. void TTLParseFree(void *pParser, void(*free)(void*) );
  9. void TTLParse(void *pParser, int tokenCode, uint8_t *token, ...);
  10. void TTLParseTrace(FILE *stream, char *zPrefix);
  11. */
  12. /** @brief Parse a single term.
  13. *
  14. * @param[in] rep N-Triples representation as a character string.
  15. *
  16. * @param[in] map Unused: there is no namespace prefixing in N-triples. Kept
  17. * for interface compatibility. May be NULL.
  18. *
  19. * @param[out] term Term to be created from the string.
  20. *
  21. * @return LSUP_OK on success, LSUP_VALUE_ERR if the string is not valid
  22. * N-Triples syntax for a IRI ref, Literal or BNode.
  23. */
  24. LSUP_rc
  25. LSUP_ttl_parse_term (const char *rep, const LSUP_NSMap *map, LSUP_Term **term);
  26. /** @brief Parse a N-Triples document from a file handle.
  27. *
  28. * @param[in] doc N-Triples document.
  29. *
  30. * @param[out] Pointer to a graph handle to be created. The new graph will have
  31. * a random UUID URN.
  32. *
  33. * @param[out] ct If not NULL it is populated with the number of triples
  34. * parsed. This may be more than the triples in the resulting graph.
  35. *
  36. * @return LSUP_OK on success, LSUP_VALUE_ERR if a parsing error was
  37. * encountered. TODO Add line/char info for parsing error
  38. */
  39. LSUP_rc
  40. LSUP_ttl_parse_doc (FILE *stream, LSUP_Graph **gr, size_t *ct, char **err);
  41. #endif