parser_nt.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _LSUP_NT_PARSER_H
  2. #define _LSUP_NT_PARSER_H
  3. #include "codec.h"
  4. /** @brief Parse a single term.
  5. *
  6. * @param[in] rep N-Triples representation as a character string.
  7. *
  8. * @param[in] map Unused: there is no namespace prefixing in N-triples. Kept
  9. * for interface compatibility. May be NULL.
  10. *
  11. * @param[out] term Term to be created from the string.
  12. *
  13. * @return LSUP_OK on success, LSUP_VALUE_ERR if the string is not valid
  14. * N-Triples syntax for a IRI ref, Literal or BNode.
  15. */
  16. LSUP_rc
  17. LSUP_nt_parse_term (const char *rep, const LSUP_NSMap *map, LSUP_Term **term);
  18. /** @brief Parse a N-Triples document from a file handle.
  19. *
  20. * @param[in] stream N-Triples doc file handler.
  21. *
  22. * @param[out] gr Pointer to a graph handle to be created. The new graph will
  23. * have a random UUID URN.
  24. *
  25. * @param[out] ct If not NULL it is populated with the number of triples
  26. * parsed. This may be more than the triples in the resulting graph.
  27. *
  28. * @param[out] err String handle to be populated with an error message.
  29. *
  30. * @return LSUP_OK on success, LSUP_VALUE_ERR if a parsing error was
  31. * encountered. On error, `err` will contain the error message.
  32. */
  33. LSUP_rc
  34. LSUP_nt_parse_doc (FILE *stream, LSUP_Graph **gr, size_t *ct, char **err);
  35. #endif