Source for file Dataset.php

Documentation is available at Dataset.php

  1. <?php
  2. // ----------------------------------------------------------------------------------
  3. // Class: Dataset
  4. // ----------------------------------------------------------------------------------
  5.  
  6. /**
  7. * Dataset implementation.
  8. * Superclass of datasetMem and datasetDb which contains shared functionality.
  9. *
  10. * <BR><BR>History:<UL>
  11. * <LI>05-02-2005 : First version of this class.</LI>
  12. * <LI>01-05-2006 : Function sparqlQuery() added.</LI>
  13. *
  14. * @version V0.9.3
  15. * @author Daniel Westphal (http://www.d-westphal.de)
  16. * @author Chris Bizer <chris@bizer.de>
  17. *
  18. * @package dataset
  19. * @access public
  20. ***/
  21.  
  22. class Dataset
  23. {
  24. /**
  25. * Load a Dataset from File
  26. *
  27. * @param string
  28. * @access public
  29. */
  30. function loadFromFile($file)
  31. {
  32. $parser= new TriXParser(&$this);
  33. $parser->parseFile($file);
  34. }
  35. /**
  36. * Load a Datset from a string
  37. *
  38. * @param string
  39. * @access public
  40. */
  41. function loadFromString($string)
  42. {
  43. $parser= new TriXParser(&$this);
  44. $parser->parseString($string);
  45. }
  46. /**
  47. * Serialize the Dataset to File
  48. *
  49. * @param string
  50. * @access public
  51. */
  52. function serializeToFile($fileName)
  53. {
  54. $serializer= new TriXSerializer(&$this);
  55. $serializer->serializeToFile($fileName);
  56. }
  57. /**
  58. * Serialize the Dataset to string
  59. *
  60. * @return string
  61. * @access public
  62. */
  63. function serializeToString()
  64. {
  65. $serializer= new TriXSerializer(&$this);
  66. return $serializer->serializeToString();
  67. }
  68. /**
  69. * Performs a SPARQL query against an RDF Dataset.
  70. * The result can be retrived in SPARQL Query Results XML Format or
  71. * as an array containing the variables an their bindings.
  72. *
  73. * @param String $query the sparql query string
  74. * @param String $resultform the result form (''xml'' for SPARQL Query Results XML Format)
  75. * @return String/array
  76. */
  77. function sparqlQuery($query,$resultform = false){
  78. include_once(RDFAPI_INCLUDE_DIR.PACKAGE_SPARQL);
  79. $parser = new SparqlParser();
  80. $q = $parser->parse($query);
  81. $eng = new SparqlEngine();
  82. return $eng->queryModel($this,$q,$resultform);
  83. }
  84. }
  85. ?>

Documentation generated on Fri, 13 Jan 2006 07:48:00 +0100 by phpDocumentor 1.3.0RC4