Пример #1
0
function getAnnotationList()
{
    $annotations = getAnnotations();
    $html .= "<ul>";
    foreach ($annotations as $annotation) {
        $html .= "<li style=\"\">{$annotation['start_time']}</li>";
    }
    $html .= "</ul>";
}
{
    $query = "SELECT * from highlight where narrative_id = " . $narrativeID . ";";
    $result = mysql_query($query);
    $data = array();
    while ($row = mysql_fetch_array($result)) {
        $info = array();
        $highlightID = $row['id'];
        $info['id'] = $highlightID;
        $info['start'] = $row['start'];
        $info['end'] = $row['end'];
        $info['startpos'] = $row['start_index'];
        $info['endpos'] = $row['end_index'];
        $info['username'] = $row['user'];
        $info['notes'] = array();
        $info['tags'] = array();
        $query = "SELECT * from highlight_xref_note, note WHERE highlight_id = " . $highlightID . " AND note_id = note.id;";
        $notes = mysql_query($query);
        while ($note = mysql_fetch_array($notes)) {
            array_push($info['notes'], array("note" => nl2br($note['text']), "id" => $note['note_id'], "username" => $note['user']));
        }
        $query = "SELECT * from highlight_xref_tag, tag WHERE highlight_id = " . $highlightID . " AND tag_id = tag.id;";
        $tags = mysql_query($query);
        while ($tag = mysql_fetch_array($tags)) {
            array_push($info['tags'], array('tag' => $tag['name'], 'username' => $tag['user'], 'id' => $tag['tag_id']));
        }
        array_push($data, $info);
    }
    echo json_encode($data);
}
getAnnotations($_GET['narrative']);
Пример #3
0
<?php

include 'dbpedia.php';
$storespecific = VIRTUOSO;
$graphURI = 'http://dbpedia.org';
$annotationGraphURI = 'http://dbpedia.org/meta';
$odbc = ODBC::getDefaultConnection();
$odbc->connect();
$total = 0;
while (count($triples = getAnnotations($graphURI)) > 0) {
    $total += deleteSubjects($odbc, $graphURI, $triples, $storespecific);
    echo 'executed ' . $total . ' delete queries' . "\n";
}
//deleteTriples($odbc,$graphURI, $triples, $storespecific);
function getAnnotations($graphURI)
{
    $lang = 'en';
    $store = new SPARQLToRDFTriple(null, $lang);
    $query = 'SELECT * FROM <' . $graphURI . '> WHERE {
			?s <' . RDF_TYPE . '> <' . OWL_AXIOM . '> .
			FILTER (isURI(?s))
		} Limit 100';
    //$subject =array('action'=>'classattribute','value'=>null);
    $subject = array('action' => 'variable', 'value' => 's');
    $predicate = array('action' => 'fix', 'value' => OWL_SUBJECT);
    $object = array('action' => 'fix', 'value' => OWL_AXIOM);
    Logger::debug($query);
    $triples = $store->getRDFTriples($query, $subject, $predicate, $object, false);
    Logger::debug('retrieved: ' . count($triples) . ' triples');
    return $triples;
}