示例#1
0
    }
}
// Add document metadata to model
$doc = new Resource($documentURI);
$resource = new Resource($resourceID);
$rdf_type = new Resource(RDF_NAMESPACE_URI . RDF_TYPE);
$foaf_Document = new Resource("http://xmlns.com/foaf/0.1/Document");
$foaf_primaryTopic = new Resource("http://xmlns.com/foaf/0.1/primaryTopic");
$foaf_maker = new Resource("http://xmlns.com/foaf/0.1/maker");
$dc_license = new Resource("http://purl.org/dc/elements/1.1/license");
$rdfs_label = new Resource("http://www.w3.org/2000/01/rdf-schema#label");
$AWS_license = new Resource("http://www.amazon.com/AWS-License-home-page-Money/b/ref=sc_fe_c_0_12738641_12/102-8791790-9885755?ie=UTF8&node=3440661&no=12738641&me=A36L942TSJ2AJA");
$Google_license = new Resource("http://www.google.com/terms_of_service.html");
$bookmashup = new Resource("http://www4.wiwiss.fu-berlin.de/is-group/resource/projects/Project10");
$model->add(new Statement($doc, $rdf_type, $foaf_Document));
$model->add(new Statement($doc, $foaf_primaryTopic, $resource));
$model->add(new Statement($doc, $dc_license, $AWS_license));
$model->add(new Statement($doc, $dc_license, $Google_license));
$model->add(new Statement($doc, $foaf_maker, $bookmashup));
$model->add(new Statement($bookmashup, $rdfs_label, new Literal("RDF Book Mashup")));
// Output model as RDF/XML
header('Content-Type: application/rdf+xml; charset=utf-8');
include RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF;
$s = new RdfSerializer();
$s->addNamespacePrefix('foaf', 'http://xmlns.com/foaf/0.1/');
$s->addNamespacePrefix('rev', 'http://dannyayers.com/xmlns/rev/#');
$s->addNamespacePrefix('scom', 'http://sites.wiwiss.fu-berlin.de/suhl/bizer/bookmashup/simpleCommerceVocab01.rdf#');
$s->addNamespacePrefix('bookRdf', 'http://www.hackcraft.net/bookrdf/vocab/0_1/');
$s->addNamespacePrefix('owl', 'http://www.w3.org/2002/07/owl#');
$s->addNamespacePrefix('skos', 'http://www.w3.org/2004/02/skos/core#');
echo $s->serialize($model);
$stmts = mapSingleFormField($userURI, "location", FOAF . "based_near", "", true);
$stmtsAll = array_merge($stmtsAll, $stmts);
$stmts = mapSingleFormField($userURI, "dblp_uri", OWL . "sameAs", "", true);
$stmtsAll = array_merge($stmtsAll, $stmts);
$stmts = mapSingleFormField($userURI, "about_me_text", RDFS . "comment", "", false);
$stmtsAll = array_merge($stmtsAll, $stmts);
/* Now for the properties that can have multiple instances */
$stmts = mapSerializedFormField($userURI, "interests_serialized", CCO . "interest");
$stmtsAll = array_merge($stmtsAll, $stmts);
$stmts = mapSerializedFormField($userURI, "expertise_serialized", CCO . "expertise");
$stmtsAll = array_merge($stmtsAll, $stmts);
/*
 *  Now for the specialized goal properties, where both
 *  property and object needs to be read from form
 */
$stmts = mapGoalFields($userURI, "goals_serialized");
$stmtsAll = array_merge($stmtsAll, $stmts);
addStmtsToModel($model, $stmtsAll);
$ser = new RdfSerializer();
$ser->addNamespacePrefix("foaf", FOAF);
$ser->addNamespacePrefix("cco", CCO);
$ser->addNamespacePrefix("serena", SERENA);
$ser->addNamespacePrefix("rdfs", RDFS);
$ser->addNamespacePrefix("rdf", RDF);
$ser->addNamespacePrefix("owl", OWL);
$rawRDF = $ser->serialize($model);
$ser->saveAs($model, $fileName);
$options = array("indent" => "    ", "linebreak" => "\n", "typeHints" => false, "addDecl" => true, "encoding" => "UTF-8", "rootName" => "rdf:RDF", "rootAttributes" => array("version" => "0.91"), "defaultTagName" => "item", "attributesArray" => "_attributes");
$serializer = new XML_Serializer($options);
$serializer->serialize($rawRDF);
$serializedRDF = $serializer->getSerializedData();
示例#3
0
        }
        foreach ($book['authors'] as $key => $author) {
            $this_author = new BlankNode("result{$i}_author" . ($key + 1));
            $model->add(new Statement($this_result, $dc_creator, $this_author));
            $model->add(new Statement($this_author, $foaf_name, new Literal($author)));
        }
        foreach ($book['subjects'] as $key => $subject) {
            $this_subject = new BlankNode("result{$i}_subject" . ($key + 1));
            $model->add(new Statement($this_result, $dc_subject, $this_subject));
            $model->add(new Statement($this_subject, $foaf_name, new Literal($subject)));
        }
    }
    header('Content-Type: application/rdf+xml; charset=utf-8');
    include RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF;
    $s = new RdfSerializer();
    $s->addNamespacePrefix('rdf', RDF_NAMESPACE_URI);
    $s->addNamespacePrefix('rdfs', RDF_SCHEMA_URI);
    $s->addNamespacePrefix('dc', DC_NS);
    $s->addNamespacePrefix('foaf', FOAF_NS);
    $s->addNamespacePrefix('search', SEARCH_NS);
    echo $s->serialize($model);
    exit;
}
?>
<html lang="en">
  <head>
    <title><?php 
if ($query) {
    ?>
Search Results: &#8220;<?php 
    echo htmlspecialchars($query);