本文整理汇总了PHP中EasyRdf_Graph::resourcesMatching方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyRdf_Graph::resourcesMatching方法的具体用法?PHP EasyRdf_Graph::resourcesMatching怎么用?PHP EasyRdf_Graph::resourcesMatching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyRdf_Graph
的用法示例。
在下文中一共展示了EasyRdf_Graph::resourcesMatching方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProperties
/**
* Recursive function to extract properties.
*
* @param string $uri
* URI of schema type.
*
* @return array|null
* Array of properties of the type and all parent types.
*/
private function getProperties($uri) {
$resource = array("type" => "uri", "value" => $uri);
$property_list = $this->graph->resourcesMatching("http://schema.org/domainIncludes", $resource);
$options = array();
foreach ($property_list as $value) {
// Omit deprecated properties.
if ($value->get("schema:supersededBy")) {
continue;
}
$options[$value->shorten()] = $value->get("rdfs:label")->getValue();
}
$parents = $this->graph->all($uri, "rdfs:subClassOf");
foreach ($parents as $value) {
$options += $this->getProperties($value->getUri());
}
return $options;
}
示例2: testResourcesMatching
public function testResourcesMatching()
{
$data = readFixture('foaf.json');
$graph = new EasyRdf_Graph('http://example.com/joe/foaf.rdf', $data);
$matched = $graph->resourcesMatching('foaf:name', 'Joe Bloggs');
$this->assertEquals(1, count($matched));
$this->assertEquals('http://www.example.com/joe#me', $matched[0]->getUri());
}
示例3: 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>
示例4: elseif
} elseif ($onto === 'tcmls') {
$onto_file = "tcmdemoen.rdf";
$namespace = 'http://www.example.com/';
} elseif ($onto === 'tcmlm') {
$onto_file = 'tcmlm-zhuling.rdf';
$namespace = 'http://www.example.com/';
}
} else {
$onto_file = "tcmdemoen.rdf";
$namespace = 'http://www.example.com/';
}
$graph = new EasyRdf_Graph("http://localhost/lod/" . $onto_file);
$graph->load();
if (isset($_GET['label'])) {
$first = true;
foreach ($graph->resourcesMatching("rdfs:label", $_GET['label']) as $r) {
if ($first) {
$localname = $r->localname();
} else {
echo "<p>" . $r . "</p>";
}
}
}
if (!isset($localname)) {
render_warning("对不起!本系统没有相关实体的信息!下面显示的是'kideny_yang_deficiency(肾阳虚)'这一示例实体。");
$localname = 'kideny_yang_deficiency';
}
?>
<div class="container">
示例5: uniqid
$uniqid = uniqid();
$suchbegriff = str_replace(" ", "+", $_GET["qname"]);
//$suchbegriff='123apfelkuchen';
$rdf = "";
if (isset($_GET["rdf"])) {
$rdf = $_GET["rdf"];
}
$basedir = dirname(realpath(__FILE__));
$root = $basedir;
$ldfu = $root . '/ldfu/bin/ldfu.sh';
$n3_programm = $root . '/n3-files/chefkoch.n3';
$input = 'http://manke-hosting.de/wrapper/index.php/explore/' . $suchbegriff;
$output = $root . '/output/' . $suchbegriff . '.nt';
if (!file_exists($output)) {
$command = 'sh ' . $ldfu . ' ' . '-i ' . $input . ' ' . '-p ' . $n3_programm . ' ' . '-o ' . $output;
shell_exec($command);
}
$graph->parseFile($output);
//$graph ->parseFile('/Users/raphaelmanke/Downloads/linked-data-fu-0.9.9/streuselkuchen3.nt');
//$me = $foaf->primaryTopic();
//echo $graph->dump('html');
$resources = $graph->resources();
$namespace = new EasyRdf_Namespace();
$namespace->set('rezept', "http://manke-hosting.de/ns-syntax#");
$rezepte = $graph->resourcesMatching('rezept:RezeptName');
if ($rdf == "true") {
header("Content-Type: text/turtle; charset=utf-8");
echo $graph->serialise("turtle");
} else {
include 'results/rezept.php';
}
示例6: testResourcesMatchingInverse
public function testResourcesMatchingInverse()
{
$data = readFixture('foaf.json');
$graph = new EasyRdf_Graph('http://example.com/joe/foaf', $data);
$matched = $graph->resourcesMatching('^foaf:homepage');
$this->assertCount(2, $matched);
$this->assertSame('http://www.example.com/joe/', $matched[0]->getUri());
$this->assertSame('http://www.example.com/project', $matched[1]->getUri());
}