本文整理汇总了PHP中EasyRdf_Graph::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::dump方法的具体用法?PHP EasyRdf_Graph::dump怎么用?PHP EasyRdf_Graph::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::dump方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: label_tag
<?php
echo label_tag('format_text', 'Text') . ' ' . radio_button_tag('format', 'text');
?>
<br />
<?php
echo submit_tag();
?>
<?php
echo form_end_tag();
?>
</div>
<?php
if (isset($_REQUEST['uri'])) {
$graph = new EasyRdf_Graph($_REQUEST['uri']);
if ($graph) {
if (isset($_REQUEST['format']) && $_REQUEST['format'] == 'text') {
print "<pre>" . $graph->dump(false) . "</pre>";
} else {
$dump = $graph->dump(true);
print preg_replace("/ href='([^#][^']*)'/e", '" href=\'?uri=".urlencode("$1")."#$1\'"', $dump);
}
} else {
print "<p>Failed to create graph.</p>";
}
}
?>
</body>
</html>
示例2: text_field_tag
<?php
echo text_field_tag('postcode', 'W1A 1AA', array('size' => 10));
?>
<?php
echo submit_tag();
echo form_end_tag();
?>
<?php
if (isset($_REQUEST['postcode'])) {
$postcode = str_replace(' ', '', strtoupper($_REQUEST['postcode']));
$docuri = "http://www.uk-postcodes.com/postcode/{$postcode}.rdf";
$graph = new EasyRdf_Graph($docuri);
$res = $graph->resource("postcode:{$postcode}");
$ll = $res->get('geo:lat') . ',' . $res->get('geo:long');
print "<iframe id='map' width='500' height='250' frameborder='0' scrolling='no' src='http://maps.google.com/maps?f=q&sll={$ll}&output=embed'></iframe>";
print "<table id='facts'>\n";
print "<tr><th>Easting:</th><td>" . $res->get('sr:easting') . "</td></tr>\n";
print "<tr><th>Northing:</th><td>" . $res->get('sr:northing') . "</td></tr>\n";
print "<tr><th>Longitude:</th><td>" . $res->get('geo:long') . "</td></tr>\n";
print "<tr><th>Latitude:</th><td>" . $res->get('geo:lat') . "</td></tr>\n";
print "<tr><th>Local Authority:</th><td>" . $res->get('ag:localAuthority')->label() . "</td></tr>\n";
print "<tr><th>Electoral Ward:</th><td>" . $res->get('eg:ward')->label() . "</td></tr>\n";
print "</table>\n";
print "<div style='clear: both'></div>\n";
print $graph->dump();
}
?>
</body>
</html>
示例3: testDumpLiterals
public function testDumpLiterals()
{
$graph = new EasyRdf_Graph();
$graph->add('http://example.com/joe#me', 'foaf:name', 'Joe');
$graph->add('http://example.com/joe#me', 'foaf:age', EasyRdf_Literal::create(52));
$deutschland = new EasyRdf_Literal('Deutschland', 'de');
$graph->add('http://example.com/joe#me', 'foaf:birthPlace', $deutschland);
$text = $graph->dump(false);
$this->assertContains('http://example.com/joe#me', $text);
$this->assertContains('-> foaf:name -> "Joe"', $text);
$this->assertContains('-> foaf:age -> "52"^^xsd:integer', $text);
$this->assertContains('-> foaf:birthPlace -> "Deutschland"@de', $text);
$html = $graph->dump(true);
$this->assertContains('http://example.com/joe#me', $html);
$this->assertContains('>foaf:name</span>', $html);
$this->assertContains('>"Joe"</span>', $html);
$this->assertContains('>foaf:age</span>', $html);
$this->assertContains('>"52"^^xsd:integer</span>', $html);
$this->assertContains('>foaf:birthPlace</span>', $html);
$this->assertContains('>"Deutschland"@de</span>', $html);
}
示例4:
}
echo "<td class=\"{$is_resource_class}\">";
echo $prop->resource_expected ? 'True' : 'False';
echo '</td>';
// write out the value
if ($is_first) {
$val_class = "herbal-value-by-prefered";
} else {
$val_class = "herbal-value-not-by-prefered";
}
if ($val) {
// make it a link
if ($is_resource) {
$val = "<a href=\"{$val}\">{$val}<a>";
}
echo '<td class="' . $val_class . '" >' . $val . '</td>';
} else {
echo '<td class="herbal-value-not-found" >NOT FOUND</td>';
}
echo '</tr>';
}
?>
</table>
<h3>Complete RDF Graph</h3>
<?php
echo $doc->dump('html');
?>
示例5: array
<?php
if (isset($_REQUEST['term'])) {
$uri = "http://dbpedia.org/resource/" . $_REQUEST['term'];
$graph = new EasyRdf_Graph($uri);
$village = $graph->resource($uri);
print content_tag('h2', $village->label($LANG));
if ($village->get('foaf:depiction')) {
print image_tag($village->get('foaf:depiction'), array('style' => 'max-width:400px;max-height:250px;'));
}
print content_tag('p', $village->get('rdfs:comment', $LANG));
if ($village->get('geo:long')) {
$ll = $village->get('geo:lat') . ',' . $village->get('geo:long');
print "<iframe width='425' height='350' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://maps.google.com/maps?f=q&sll={$ll}&output=embed'></iframe>";
}
echo "<br /><br />";
echo $graph->dump();
} else {
$uri = "http://dbpedia.org/resource/Category:Villages_in_Fife";
$graph = new EasyRdf_Graph($uri);
$category = $graph->resource($uri);
foreach ($graph->resourcesMatching('skos:subject', $category) as $resource) {
$term = str_replace('http://dbpedia.org/resource/', '', $resource);
$label = urldecode(str_replace('_', ' ', $term));
print '<li>' . link_to_self($label, 'term=' . $term) . "</li>\n";
}
}
?>
</body>
</html>
示例6: testDump
public function testDump()
{
$graph = new EasyRdf_Graph();
$graph->add('http://example.com/joe#me', 'foaf:name', 'Joe');
$text = $graph->dump(false);
$this->assertContains('http://example.com/joe#me', $text);
$this->assertContains('-> foaf:name -> "Joe"', $text);
$html = $graph->dump(true);
$this->assertContains('http://example.com/joe#me', $html);
$this->assertContains('>foaf:name</span>', $html);
$this->assertContains('>"Joe"</span>', $html);
}
示例7: htmlRenderer
public static function htmlRenderer(Graph $graph)
{
static::setContentType('text/html');
return static::htmlSerializer($graph->dump('html'), Standard::$htmlMetadata, $graph->getUri(), null, null, true);
}