Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> RDF API for PHP - graf z dokumentu RDF, prezentacja grafu z uzyciem RAP
adas007
post
Post #1





Grupa: Zarejestrowani
Postów: 72
Pomógł: 0
Dołączył: 9.03.2007

Ostrzeżenie: (0%)
-----


Dostałem na uczelni zadanie... mam napisać skrypt php wizualizujący w postaci grafu dokument rdf. Wykorzystać mam bibliotekę RAP (RDF API for PHP). Korzystam z takiego tutoriala: http://www4.wiwiss.fu-berlin.de/bizer/rdfa...on_tutorial.htm Skrypt ma korzystać z programu Graphviz, który ma ten graf wyrysować (tak to rozumiem po przeczytaniu powyższego tutoriala). Oto mój kod:
  1. <?php
  2. ini_set( 'display_errors', 'On' );
  3. error_reporting( E_ALL );
  4. define("RDFAPI_INCLUDE_DIR", "rdfapi-php/api/");
  5. include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
  6.  
  7.  
  8. // Filename of an RDF document
  9. $base="przyklad.rdf";
  10.  
  11. // Create a new MemModel
  12. $model = ModelFactorgetDefaultModel();
  13.  
  14. // Load and parse document
  15. $model->load($base);
  16.  
  17. // Visualize model
  18.  
  19.  
  20. $model->visualize('gif');
  21. header('Content-ty: image/gif');/php]
  22.  
  23. Muszę też ustawić config w bibliotece rdf-api odpowiedzialny za program GRAPHVIZ robie to w pliku constatnts.php zgodnie z tutorialem.Część confogu odpowiedzialna za ten program znajduje się t<span style="color: #007700":
  24. [php]
  25. <?php
  26. // ----------------------------------------------------------------------------------
  27. // GRAPHVIZ
  28. // ----------------------------------------------------------------------------------
  29.  
  30. // path to the dot binary
  31. define('GRAPHVIZ_PATH', :Program FilesGraphviz2.20bindot.exe');
  32.  
  33. // directory for temporary files
  34. // Attentio: must be write-/readable by the webserver
  35. define('GRAPHVIZ_TEMP', :wampwwwRDF\temp');
  36.  
  37. // display statistical data in generated images
  38. // currently only number of statements drawn
  39. define('GRAPHVIZ_STAT', TRUE);
  40.  
  41. // allowed file formats
  42. // for security reasons (to prevent code injection)
  43. define('GRAPHVIZ_FORMAT', 'svg, dot, jpg, png, gif, vrml');
  44.  
  45. // enable clickable URIs
  46. // only supported by certain formats (e.g. SVG)
  47. define('GRAPHVIZ_URI', FALSE);
  48.  
  49. // define parameters for the graphical output
  50. // if a paramter is undefined, the default value of graphviz is used
  51. // for further information s: <a href=\"ht://www.graphviz.org/Documentation.php\" target=\"_blank\">ht://www.graphviz.org/Documentation.php</a>
  52. $graphviz_param = array(
  53.   'GRAPH_STYLE'     => 'rankdir="TB"',
  54.   'RESOURCE_STYLE'  => 'style="filled",color="#FFD800",fontname="Courier",fontsize="10"',
  55.   'LITERAL_STYLE'   => 'shape="box",style="filled",color="#B7FFAF",fontname="Courier",fontsize="10"',
  56.   'PREDICATE_STYLE' => 'fontname="Courier",fontsize="10"',
  57.   'INFERRED_STYLE'  => 'style="dotted",fontname="Courier",fontsize="10"',
  58.   'BLANKNODE_STYLE' => 'style="filled",color="#DDDDDD",fontname="Courier",fontsize="10"',
  59.   'BOX_STYLE'       => 'fontname="Courier",fontsize="8",color="#BBBBBB"'
  60. );
  61. ?>


Graf nie pojawia się w przeglądarce...

Ten post edytował adas007 17.09.2008, 15:48:34
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 04:24