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:
<?php
define("RDFAPI_INCLUDE_DIR", "rdfapi-php/api/"); include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
// Filename of an RDF document
$base="przyklad.rdf";
// Create a new MemModel
$model = ModelFactorgetDefaultModel();
// Load and parse document
$model->load($base);
// Visualize model
$model->visualize('gif');
header('Content-ty: image/gif');/php
]
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":
[php]
<?php
// ----------------------------------------------------------------------------------
// GRAPHVIZ
// ----------------------------------------------------------------------------------
// path to the dot binary
define('GRAPHVIZ_PATH', :Program FilesGraphviz2
.20bindot
.exe
');
// directory for temporary files
// Attentio: must be write-/readable by the webserver
define('GRAPHVIZ_TEMP', :wampwwwRDF\temp');
// display statistical data in generated images
// currently only number of statements drawn
define('GRAPHVIZ_STAT', TRUE);
// allowed file formats
// for security reasons (to prevent code injection)
define('GRAPHVIZ_FORMAT', 'svg, dot, jpg, png, gif, vrml');
// enable clickable URIs
// only supported by certain formats (e.g. SVG)
define('GRAPHVIZ_URI', FALSE);
// define parameters for the graphical output
// if a paramter is undefined, the default value of graphviz is used
// for further information s: <a href=\"ht://www.graphviz.org/Documentation.php\" target=\"_blank\">ht://www.graphviz.org/Documentation.php</a>
'GRAPH_STYLE' => 'rankdir="TB"',
'RESOURCE_STYLE' => 'style="filled",color="#FFD800",fontname="Courier",fontsize="10"',
'LITERAL_STYLE' => 'shape="box",style="filled",color="#B7FFAF",fontname="Courier",fontsize="10"',
'PREDICATE_STYLE' => 'fontname="Courier",fontsize="10"',
'INFERRED_STYLE' => 'style="dotted",fontname="Courier",fontsize="10"',
'BLANKNODE_STYLE' => 'style="filled",color="#DDDDDD",fontname="Courier",fontsize="10"',
'BOX_STYLE' => 'fontname="Courier",fontsize="8",color="#BBBBBB"'
);
?>
Graf nie pojawia się w przeglądarce...
Ten post edytował adas007 17.09.2008, 15:48:34