Exemplo n.º 1
0
function ntriples2php($data)
{
    // Prepare RDF
    $rdfInput = $data;
    // Show the submitted RDF
    // Create a new MemModel
    $model = ModelFactory::getDefaultModel();
    $n3pars = new n3Parser();
    // Load and parse document
    #$model->load($rdfInput);
    $model = $n3pars->parse2model($rdfInput);
    // Set the base URI of the model
    #$model->setBaseURI("http://www3.wiwiss.fu-berlin.de".$HTTP_SERVER_VARS['PHP_SELF']."/DemoModel#");
    $model->setBaseURI(S3DB_URI_BASE);
    return $model;
}
Exemplo n.º 2
0
 /////////////////////////////////////////////////////////////////
 // Process RDF
 // (if submitted and RDF smaller than 10000 chars)
 /////////////////////////////////////////////////////////////////
 define("RDFAPI_INCLUDE_DIR", "./../api/");
 include RDFAPI_INCLUDE_DIR . "RdfAPI.php";
 include RDFAPI_INCLUDE_DIR . "syntax/SyntaxN3.php";
 include RDFAPI_INCLUDE_DIR . "syntax/SyntaxRDF.php";
 // Prepare RDF
 $rdfInput = $_POST['RDF'];
 // Show the submitted RDF
 echo "<BR><H3>Your original N3 input:</h3><BR>";
 echo_string_with_linenumbers($rdfInput);
 // Create a new MemModel
 $model = ModelFactory::getDefaultModel();
 $n3pars = new n3Parser();
 // Load and parse document
 #$model->load($rdfInput);
 $model = $n3pars->parse2model($rdfInput);
 // Set the base URI of the model
 $model->setBaseURI("http://www3.wiwiss.fu-berlin.de" . $HTTP_SERVER_VARS['PHP_SELF'] . "/DemoModel#");
 // Execute query on model if submitted
 if ($_POST['query_subject'] != '' or $_POST['query_predicate'] != '' or $_POST['query_object'] != '') {
     $comment_string = "<BR><H3>The following query has been executed:</H3><BR>";
     $query_subj = NULL;
     $query_pred = NULL;
     $query_obj = NULL;
     if ($_POST['query_subject'] != '') {
         if ($_POST['subject_kind'] == 'resource') {
             $query_subj = new Resource($_POST['query_subject']);
         } else {