parser_nt.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _VOLK_NT_PARSER_H
  2. #define _VOLK_NT_PARSER_H
  3. #include "volksdata/codec.h"
  4. /** @brief Parse a single term.
  5. *
  6. * @param[in] rep N-Triples representation as a character string.
  7. *
  8. * @param[out] term Term to be created from the string.
  9. *
  10. * @return VOLK_OK on success, VOLK_VALUE_ERR if the string is not valid
  11. * N-Triples syntax for a IRI ref, Literal or BNode.
  12. */
  13. VOLK_rc
  14. VOLK_nt_parse_term (const char *rep, VOLK_Term **term);
  15. /** @brief Parse a N-Triples document from a file handle.
  16. *
  17. * @param[in] stream N-Triples doc file handler.
  18. *
  19. * @param[out] gr Pointer to a graph handle to be created. The new graph will
  20. * have a random UUID URN.
  21. *
  22. * @param[out] ct If not NULL it is populated with the number of triples
  23. * parsed. This may be more than the triples in the resulting graph.
  24. *
  25. * @param[out] err String handle to be populated with an error message.
  26. *
  27. * @return VOLK_OK on success, VOLK_VALUE_ERR if a parsing error was
  28. * encountered. On error, `err` will contain the error message.
  29. */
  30. VOLK_rc
  31. VOLK_nt_parse_doc (
  32. FILE *fh, const char *sh, VOLK_Graph **gr, size_t *ct, char **err);
  33. #endif