本文整理汇总了PHP中ARC2::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getComponent方法的具体用法?PHP ARC2::getComponent怎么用?PHP ARC2::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::getComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getANodeNeg
function getANodeNeg()
{
$conf = array('ns' => array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'dbpedia' => 'http://dbpedia.org/ontology/', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'xsd' => 'http://www.w3.org/2001/XMLSchema#', 'dcterms' => 'http://purl.org/dc/terms/'));
$docNeg = $this->getDOMDocNeg();
$aNodes = $docNeg->source->getElementsByTagName('a');
$conf['source'] = $aNodes->item(0);
return ARC2::getComponent('negotiators_ANodePlugin', $conf);
}
示例2: __construct
public function __construct($contextURIs)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
$this->uris = $contextURIs;
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
}
示例3: getNegotiators
public function getNegotiators($val, $nArray = false)
{
$retArray = array();
$nArray = $nArray ? $nArray : $this->negotiators;
foreach ($this->negotiators as $n) {
if ($this->applyTestOnNegotiator($n, $val)) {
$retArray[] = ARC2::getComponent($n);
}
}
}
示例4: __construct
public function __construct($array)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
if (isset($array['uris'])) {
$this->uris = $array['uris'];
}
if (isset($array['tagURIs'])) {
$this->tagURIs = $array['tagURIs'];
}
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
}
示例5: __construct
public function __construct($vars)
{
global $config;
global $graphConfig;
$this->store = ARC2::getStore($config);
foreach ($vars as $var => $val) {
$this->{$var} = $val;
}
$this->graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
$this->setQuery();
$this->doQuery();
$this->processResultSet();
}
示例6: transform
public function transform($settings = '')
{
if ($settings != '') {
foreach ($settings as $setting => $value) {
$this->{$setting} = $value;
}
}
$this->a = $this->config_ns();
foreach ($this->required as $require) {
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $require . '.php';
}
$this->ARC2 = ARC2::getComponent('RDFTranformrPlugin', $this->a);
return $this->query != '' ? $this->json_query($this->query) : $this->transformr_types();
}
示例7: testAddPropValue
public function testAddPropValue()
{
$res = $this->getRes();
$res->addPropValue('foaf:page', 'http://www.patrickgmj.net/blog');
$this->assertTrue(in_array('http://www.patrickgmj.net/blog', $res->getFlattenedProps('foaf:page')));
$res->addPropValue('rdfs:type', 'foaf:Agent');
$this->assertTrue(in_array('http://xmlns.com/foaf/0.1/Agent', $res->getFlattenedProps('rdfs:type')));
$res2 = ARC2::getComponent('PMJ_ResourcePlusPlugin', array('ns' => array('foaf' => 'http://xmlns.com/foaf/0.1/')));
$res2->setURI('http://example.com');
$res2->addPropValue('rdfs:type', 'foaf:Agent');
$this->assertEquals(1, $res2->triplesCount());
$res2->addPropValue('rdfs:type', 'foaf:Agent');
$this->assertEquals(1, $res2->triplesCount());
}
示例8: testInit
public function testInit()
{
$conf = array('ns' => array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'dbpedia' => 'http://dbpedia.org/ontology/', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'xsd' => 'http://www.w3.org/2001/XMLSchema#', 'dcterms' => 'http://purl.org/dc/terms/'), 'store' => $this->store);
$n = ARC2::getComponent('negotiators_DataNegotiatorPlugin', $conf);
$this->assertTrue(isset($n->store));
$this->assertEquals('NegotiatorSelector', get_class($n->selector));
$this->assertTrue(count($n->selector->negotiators) > 0);
//test adding to a predefined ns (e.g., sioc prefix already present, but not clobbered on init)
$testN = ARC2::getComponent('negotiators_TestPlugin', $conf);
$this->assertTrue(array_key_exists('foaf', $testN->ns));
$this->assertTrue(array_key_exists('test', $testN->ns));
//test setting currURI from caller
$this->assertEquals($n->currURI, $testN->currURI);
//test setting revURI from caller
$this->assertEquals($n->currURI, $testN->revURI);
}
示例9: preProcess
function preProcess()
{
date_default_timezone_set('America/New_York');
$linkNodes = $this->xpath->query('link', $this->source);
$postPage = $this->trimSlash($linkNodes->item(0)->textContent);
$postURI = $postPage . '#this';
$postRes = ARC2::getComponent('PMJ_ResourcePlusPlugin', array('ns' => $this->ns));
$postRes->setURI($postURI);
$postRes->addPropValue($this->revProp, $this->revURI);
$titleNodes = $this->xpath->query('title', $this->source);
$postRes->addPropValue('dcterms:title', $titleNodes->item(0)->textContent);
$createdNodes = $this->xpath->query('pubDate', $this->source);
$created = $createdNodes->item(0)->textContent;
$createdDateTime = date_create($created);
$postRes->addPropValue('dcterms:created', $createdDateTime->format('c'), 'literal', 'xsd:dateTime');
$this->graph->addResource($postRes);
}
示例10: preProcess
function preProcess()
{
$linkNodes = $this->xpath->query('//channel/link');
$linkNode = $linkNodes->item(0);
$pageURL = $this->trimSlash($linkNode->textContent);
$siteURI = $pageURL . "#this";
$siteRes = ARC2::getComponent('PMJ_ResourcePlusPlugin', array('ns' => $this->ns));
$siteRes->setURI($siteURI);
$titles = $this->xpath->query('//channel/title');
$siteRes->addPropValue('dcterms:title', $titles->item(0)->textContent, 'literal');
$siteRes->addPropValue('rdf:type', 'sioc:Site');
$siteRes->addPropValue('foaf:page', $pageURL);
$this->graph->addResource($siteRes);
$items = $this->source->getElementsByTagName('item');
for ($i = 0; $i < $items->length; $i++) {
$this->addSubNegotiator('negotiators_RSSItemPlugin', array('source' => $items->item($i), 'revURI' => $siteURI, 'xpath' => $this->xpath));
}
}
示例11: curl_get
function curl_get($url)
{
$reader = ARC2::getComponent('Reader', $conf);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$headers = array();
$headers[] = 'Accept: text/xml';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
try {
$content = curl_exec($ch);
$error_code = curl_errno($ch);
curl_close($ch);
} catch (Exception $e) {
echo " (curl error): " . $e->getMessage() . PHP_EOL;
}
return $content;
}
示例12: elseif
$index = ARC2::getSimpleIndex($triples, false);
/* false -> non-flat version */
$rdf_doc = $parser->toTurtle($index, $ns);
} elseif ($format == 'json' || $format == 'rdf-json') {
ini_set("include_path", S3DB_SERVER_ROOT . "/pearlib/arc" . PATH_SEPARATOR . ini_get("include_path"));
include_once "ARC2.php";
$a['ns'] = $ns;
$parser = ARC2::getComponent('RDFJSONSerializer', $a);
$index = ARC2::getSimpleIndex($triples, false);
$rdf_doc = $parser->toRDFJSON($index, $ns);
} else {
$format = 'n3';
ini_set("include_path", S3DB_SERVER_ROOT . "/pearlib/arc" . PATH_SEPARATOR . ini_get("include_path"));
include_once "ARC2.php";
$a['ns'] = $ns;
$parser = ARC2::getComponent('NTriplesSerializer', $a);
$index = ARC2::getSimpleIndex($triples, false);
/* false -> non-flat version */
$rdf_doc = $parser->toNTriples($index, $ns);
}
fwrite($fid, $rdf_doc);
fclose($fid);
chmod($FinalFfilename, 0777);
##Prepare to output
$linkname = random_string('10') . '.' . $format;
$filelink = $GLOBALS['URI'] . '/extras/' . $linkname;
if (!copy($FinalFfilename, S3DB_SERVER_ROOT . '/extras/' . $linkname)) {
echo "Could not copy the file. This could be because Apache does not have 'write' permission on the s3db folder or the /extras/.";
exit;
}
if (in_array('link', array_keys($inputs))) {
示例13: header
//error_reporting(E_ALL);
include 'config.php';
include_once 'checkLogin.php';
include ARC_DIR . 'ARC2.php';
include_once CLASSES_DIR . 'RubrickBuilder.php';
include_once CLASSES_DIR . 'Rubric.php';
include_once CLASSES_DIR . 'Context.php';
include_once CLASSES_DIR . 'RubricLine.php';
include_once CLASSES_DIR . 'RubricLineValue.php';
include_once CLASSES_DIR . 'Tagging.php';
header("Content-type: application/json");
$store = ARC2::getStore($config);
//$jsonStr = '{"rubricLines":[{"action":"create","fields":[{"Name":["line%201"]},{"Description":["Describe%20the%20skills%20that%20this%20line%20evaluates"]},{"Tags":["Add%20a%20tag"]},{"Public":[1]},{"order":["0"]},{"v5":["Describe%20the%20Rubric%20Value%20here."],"score":1},{"v4":["Describe%20the%20Rubric%20Value%20here."],"score":2},{"v3":["Describe%20the%20Rubric%20Value%20here."],"score":3},{"v2":["Describe%20the%20Rubric%20Value%20here."],"score":4},{"v1":["Describe%20the%20Rubric%20Value%20here."],"score":5}]},{"action":"create","fields":[{"Name":["line%202"]},{"Description":["Describe%20the%20skills%20that%20this%20line%20evaluates"]},{"Tags":["line%20tag"]},{"Public":[1]},{"order":["1"]},{"v5":["Describe%20the%20Rubric%20Value%20here."],"score":1},{"v4":["Describe%20the%20Rubric%20Value%20here."],"score":2},{"v3":["Describe%20the%20Rubric%20Value%20here."],"score":3},{"v2":["Describe%20the%20Rubric%20Value%20here."],"score":4},{"v1":["Describe%20the%20Rubric%20Value%20here."],"score":5}]}],"rubricMeta":{"name":{"rName":["Rubric%20Name"]},"desc":{"rDesc":["Rubric%20Description"]},"tags":{"rTags":["t1","t2"]},"pub":{"rPublic":[1]},"contexts":{"rContexts":["http%3A%2F%2Fdata.rubrick-jetpack.org%2FContext%2F7af867eb16d35a749874fb71a62ecea2714c14b0"]}}}';
$jsonStr = ' { "literals" : [ { "p" : "tagging:tagging" , "o" : "test tag" } ,
{ "p" : "tagging:tagging" , "o" : "stuff" } ]} ';
$jsonObj = json_decode($jsonStr);
$init = array('post' => $jsonObj);
$bigGraph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
$newRes = new Tagging(false, $init);
$newRes->buildAddGraph();
//echo count($newRes->aggregates);
//$ag = $newRes->aggregates[0];
//echo $ag->getRevTriple();
//echo $ag->revResourceURI;
$bigGraph->mergeResourceGraph($newRes->addGraph);
foreach ($newRes->aggregates as $ag) {
$bigGraph->mergeResourceGraph($ag->addGraph);
}
echo json_encode($bigGraph->toRDFJSON(true));
//echo count($newRes->aggregates);
示例14: sha1
$parser->extractRDF('dc rdfa');
$triples = $parser->getTriples();
$q = 'INSERT INTO <> { ' . $parser->toNTriples($triples) . ' } ';
$parseRS = $store->query($q);
$graph = ARC2::getComponent('PMJ_ResourceGraphPlugin', $graphConfig);
$recordingRes = ARC2::getComponent('PMJ_ResourcePlusPlugin', $graphConfig);
$userURI = $_SESSION['userURI'];
$recordingURI = 'http://data.rubrick-jetpack.org/Recordings/' . sha1($userURI . time());
$recordingRes->setURI($recordingURI);
$recordingRes->addPropValue('rdf:type', 'r:Recording', 'uri');
$recordingRes->addPropValue('sioc:has_creator', $userURI, 'uri');
$recordingRes->addPropValue('r:hasPage', $_POST['page'], 'uri');
$recordingRes->addPropValue('dcterms:created', date('c'), 'literal', 'xsd:dateTime');
$recordingRes->addPropValue('r:hasRubric', $_POST['rubric'], 'uri');
if (is_array($_POST['r:hasLineValues'])) {
foreach ($_POST['r:hasLineValues'] as $lineValueURI) {
$recordingRes->addPropValue('r:hasLineValue', $lineValueURI, 'uri');
}
} else {
$recordingRes->addPropValue('r:hasLineValue', $_POST['lineValues'], 'uri');
}
$contextRes = ARC2::getComponent('PMJ_ResourcePlusPlugin', $graphConfig);
$contextRes->setURI($_POST['context']);
$contextRes->addPropValue('r:hasRecording', $recordingURI, 'uri');
$graph->addResource($contextRes);
$graph->addResource($recordingRes);
$q = 'INSERT INTO <> { ' . $graph->toNTriples() . ' } ';
//echo htmlspecialchars($graph->toNTriples());
$rs = $store->query($q);
$message = 'Data is happily saved!';
echo "{ message : '" . $message . "' }";
示例15: draw_onto
public function draw_onto()
{
$onto_store_config = $this->ontostore_params;
$store = ARC2::getStore($onto_store_config);
/* configuration */
$config = array('graphviz_path' => 'dot', 'graphviz_temp' => '/tmp/', 'ns' => $this->namespaces);
/* instantiation */
$viz = ARC2::getComponent('TriplesVisualizerPlugin', $config);
foreach ($this->namespaces as $key => $uri) {
$prefix .= "PREFIX " . $key . ": <" . $uri . ">";
}
if (isset($_POST['query'])) {
$_POST['query'] = $prefix . "\n\t\t\t" . $_POST['query'];
}
$query = "SELECT * WHERE {\n\t\t\t?s rdf:type owl:Class .\n\t\t\t?s ?p ?o .\n\t\t\tFILTER(!(?p=<http://www.pmbservices.fr/ontology#displayLabel>)) \n\t\t\tFILTER(!(?p=<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>)) \t\n\t\t}";
$classes = $store->query($query, 'rows');
$query = "SELECT * WHERE {\n\t\t\t?s rdf:type owl:ObjectProperty .\n\t\t\t?s ?p ?o .\n\t\t\tFILTER(!(?p=<http://www.pmbservices.fr/ontology#displayLabel>))\n\t\t\tFILTER(!(?p=<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>))\n\t\t\tFILTER(!(?p=<http://www.pmbservices.fr/ontology#datatype>))\n\t\t}";
$properties = $store->query($query, 'rows');
/* display an svg image */
$svg = $viz->draw(array_merge($classes, $properties), 'svg', 'raw');
print $svg;
}