当前位置: 首页>>代码示例>>PHP>>正文


PHP ARC2::getRDFXMLParser方法代码示例

本文整理汇总了PHP中ARC2::getRDFXMLParser方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::getRDFXMLParser方法的具体用法?PHP ARC2::getRDFXMLParser怎么用?PHP ARC2::getRDFXMLParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ARC2的用法示例。


在下文中一共展示了ARC2::getRDFXMLParser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

    function __construct( $importdata, $dataformat ) {
        global $rdfiogExtraNSPrefixes,
        $rdfiogPropertiesToUseAsWikiTitle,
        $rdfiogUseNSPrefixInWikiTitleForProperties,
        $rdfiogUseNSPrefixInWikiTitleForEntities;

        if ( $dataformat == 'triples_array' ) {
            $this->m_triples = $importdata;
        } else {
            $this->m_unparseddata = $importdata;
        }
        $this->m_dataformat = $dataformat;
        $this->m_haserrors = false;
        $this->m_delete = false;
        if ( $this->m_dataformat == 'rdfxml' ) {
            $this->m_unparseddata = $this->cleanupXML( $this->m_unparseddata );
            $this->m_parser = ARC2::getRDFXMLParser();
            $this->parse();
        } elseif ( $this->m_dataformat == 'turtle' ) {
            $this->m_unparseddata = $wgRequest->getText( 'importdata' );
            $this->m_parser = ARC2::getTurtleParser();
            $this->parse();
        }
        $this->extractTripleIndex();
        $this->m_nsprefixes = $this->getNSPrefixMappingFromParser();
        if ( $rdfiogExtraNSPrefixes != '' ) {
            $this->addNamespacePrefixes( $rdfiogExtraNSPrefixes );
        }
        $nsprefixes = $this->m_nsprefixes;
        $this->setNSPrefixes( $nsprefixes );
        $this->setTripleIndex( $this->m_tripleindex );

        // Previously in Equiv URI Class

        if ( isset($rdfiogUsePseudoNamespacesForProperties) ) { // TODO: Change to check options from import screen
            // use parameter set in LocalSettings.php
            $this->m_usenspintitles_properties = $rdfiogUsePseudoNamespacesForProperties;
        }

        if ( isset($rdfiogUsePseudoNamespacesForEntities) ) {
            // use parameter set in LocalSettings.php
            $this->m_usenspintitles_entities = $rdfiogUsePseudoNamespacesForEntities;
        }

        if ( !empty( $rdfiogPropertiesToUseAsWikiTitle ) ) {
            $this->m_wikititlepropertyuris = $rdfiogPropertiesToUseAsWikiTitle;
        } else {
            $this->m_wikititlepropertyuris = array(
            	'http://semantic-mediawiki.org/swivt/1.0#page', // Suggestion for new property
            	'http://www.w3.org/2000/01/rdf-schema#label',
            	'http://purl.org/dc/elements/1.1/title',
            	'http://www.w3.org/2004/02/skos/core#preferredLabel',
            	'http://xmlns.com/foaf/0.1/name'
            	);
        }

        $this->m_store = new RDFIOStore();
    }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:58,代码来源:SMWBatchWriter.php

示例2: parse_to_simple_index

function parse_to_simple_index($rdfxml)
{
    $triples = array();
    if (strlen($rdfxml) > 0) {
        $parser = ARC2::getRDFXMLParser();
        $parser->parse(null, $rdfxml);
        $triples = $parser->getSimpleIndex(0);
    }
    return $triples;
}
开发者ID:jhigman,项目名称:TalisRdfEditor,代码行数:10,代码来源:utils.inc.php

示例3: describe_to_triple_list

 /**
  * @deprecated triple lists are deprecated
  */
 function describe_to_triple_list($uri, $graphs = array())
 {
     $triples = array();
     $response = $this->describe($uri, $graphs);
     if ($response->body) {
         $parser_args = array("bnode_prefix" => "genid", "base" => $this->uri);
         $parser = ARC2::getRDFXMLParser($parser_args);
         $parser->parse("", $response->body);
         $triples = $parser->getTriples();
     }
     return $triples;
 }
开发者ID:risis-eu,项目名称:RISIS_LinkedDataAPI,代码行数:15,代码来源:multisparqlservice.class.php

示例4: get_item_uris

 /**
  * get_snapshots
  *
  * @return array
  * @author Keith Alexander
  **/
 public function get_item_uris()
 {
     $parser = ARC2::getRDFXMLParser();
     $parser->parse($this->uri);
     $triples = $parser->getTriples();
     $this->errors = $parser->getErrors();
     $uris = array();
     foreach ($triples as $t) {
         if ($t['p'] == 'http://schemas.talis.com/2006/bigfoot/configuration#snapshot') {
             $uris[] = $t['o'];
         }
     }
     return $uris;
 }
开发者ID:jhigman,项目名称:TalisRdfEditor,代码行数:20,代码来源:snapshots.class.php

示例5: test_put_to_network_includes_body

 function test_put_to_network_includes_body()
 {
     $fake_request_factory = new FakeRequestFactory();
     $fake_request = new FakeHttpRequest(new HttpResponse(200));
     $fake_request_factory->register('PUT', "http://example.org/res", $fake_request);
     $group = new NetworkResource("http://example.org/res");
     $group->add_resource_triple("http://example.org/res", "http://example.org/pred", "http://example.org/obj");
     $group->request_factory = $fake_request_factory;
     $group->put_to_network();
     $parser = ARC2::getRDFXMLParser(array("bnode_prefix" => "genid", "base" => 'http://example.org/'));
     $parser->parse('http://example.org/', $fake_request->get_body());
     $triples = $parser->getTriples();
     $this->assertEquals(1, count($triples));
 }
开发者ID:risis-eu,项目名称:RISIS_LinkedDataAPI,代码行数:14,代码来源:networkresource.test.php

示例6: get_item_uris

 /**
  * get_item_uris
  *
  * @return array
  * @author Chris Clarke
  **/
 public function get_item_uris()
 {
     $request = $this->request_factory->make('GET', $this->uri, $this->credentials);
     $request->set_accept("application/rdf+xml");
     $response = $request->execute();
     $parser = ARC2::getRDFXMLParser();
     $parser->parse('', $response->body);
     $triples = $parser->getTriples();
     $this->errors = $parser->getErrors();
     $uris = array();
     foreach ($triples as $t) {
         if ($t['p'] == 'http://schemas.talis.com/2006/bigfoot/configuration#snapshot') {
             $uris[] = $t['o'];
         }
     }
     return $uris;
 }
开发者ID:risis-eu,项目名称:RISIS_LinkedDataAPI,代码行数:23,代码来源:snapshots.class.php

示例7: importRdfXml

 /**
  * Import RDF/XML, e.g. from the RDF Import Special Page.
  * @param string $importData
  */
 public function importRdfXml($importData)
 {
     // Parse RDF/XML to triples
     $arc2rdfxmlparser = ARC2::getRDFXMLParser();
     $arc2rdfxmlparser->parseData($importData);
     // Receive the data
     $triples = $arc2rdfxmlparser->triples;
     $tripleIndex = $arc2rdfxmlparser->getSimpleIndex();
     $namespaces = $arc2rdfxmlparser->nsp;
     /* DEBUGGING
     		echo "*** Triples ***";
     		echo( print_r( $triples, true ));
     		echo "*** Triple index ***";
     		echo( print_r( $tripleIndex, true ));
     		echo "*** Namespaces ***";
     		echo( print_r( $namespaces, true ));
     		*/
     $this->importFromArc2Data($triples, $tripleIndex, $namespaces);
     return $output = array('triples' => $triples, 'tripleIndex' => $tripleIndex, 'namespaces' => $namespaces);
 }
开发者ID:rdfio,项目名称:RDFIO,代码行数:24,代码来源:RDFIO_RDFImporter.php

示例8: extractOAI

/**
* Extrahiert eingebettetes rdfa aus einer beliebigen HTML Seite und
* speichert es im triple store
* @param string $url
* @return Response Ein Responseobjekt
*/
function extractOAI($rdf, $url)
{
    global $ep;
    // Wenn es die URL im Graph schon gibt, nichts machen
    if (graphContainsUrl($url)) {
        $res = new Response(null, "URL {$url} already visited, skip indexing");
        return $res;
    } else {
        $parser = ARC2::getRDFXMLParser();
        $parser->parse($url, $rdf);
        // triple Darstellung
        $triples = $parser->getTriples();
        // Wenn kein OAI gefunden wurde
        if (count($triples) < 1) {
            $res = new Response(null, "URL {$url} contains no OAI-RDF");
            return $res;
        }
        // in Datenbank einfuegen
        $ep->insert($triples, "");
        $res = new Response(null, "URL {$url}: added " . count($triples) . " triples");
        return $res;
    }
}
开发者ID:neumann89,项目名称:FUB-xml-project6-2013,代码行数:29,代码来源:OAIEndPoint.php

示例9: OWL2RDF

 private function OWL2RDF($abbv)
 {
     $filename = parent::getReadFile()->getFilename();
     $buf = file_get_contents("compress.zlib://" . $filename);
     $parser = ARC2::getRDFXMLParser('file://' . $filename);
     $parser->parse("http://bio2rdf.org/bioportal#", $buf);
     $triples = $parser->getTriples();
     foreach ($triples as $i => $a) {
         $this->TriplifyMap($a, strtolower($abbv));
         parent::writeRDFBufferToWriteFile();
     }
     parent::clear();
 }
开发者ID:zorino,项目名称:bio2rdf-scripts,代码行数:13,代码来源:bioportal.php

示例10: addRDFXML

 /**
  * As for addTurtle but load a string of RDF XML
  *
  * @see addTurtle
  */
 function addRDFXML($base, $data)
 {
     $parser = ARC2::getRDFXMLParser($this->arc2config);
     $parser->parse($base, $data);
     $errors = $parser->getErrors();
     $parser->resetErrors();
     if (sizeof($errors)) {
         if ($this->debug) {
             print "<h3>Error loading RDFXML string</h3>";
             print "<ul><li>" . join("</li><li>", $errors) . "</li></ul>";
         }
         return 0;
     }
     return $this->addTriples($parser->getTriples());
 }
开发者ID:rebe100x,项目名称:YAKREP,代码行数:20,代码来源:Graphite.php

示例11: curl_setopt

 curl_setopt($ch, CURLOPT_URL, $u);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
 curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: text/turtle, text/n3; q=0.9, application/turtle; q=0.8, application/n-triples; q=0.7, application/rdf+xml; q=0.6, application/json; q=0.4, */*; q=0.1"));
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $data = curl_exec($ch);
 $_aux = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
 $_aux2 = explode(";", $_aux);
 $content_type = array_shift($_aux2);
 curl_close($ch);
 $parser = NULL;
 $parsers = array();
 $parsers[0]['formats'] = array('text/n3', 'application/x-turtle', 'application/turtle', 'text/turtle');
 $parsers[0]['parser'] = ARC2::getTurtleParser();
 $parsers[1]['formats'] = array('application/rdf+xml');
 $parsers[1]['parser'] = ARC2::getRDFXMLParser();
 $parsers[2]['formats'] = array('application/json', 'application/x-javascript', 'text/javascript', 'text/x-javascript', 'text/x-json');
 $parsers[2]['parser'] = ARC2::getJSONParser();
 foreach ($parsers as $v) {
     if (in_array($content_type, $v['formats'])) {
         $parser = $v['parser'];
     }
 }
 //If nothing fits, pray to your favorite god that this can be detected and parsed correctly by ARC2.
 $parser = ARC2::getRDFParser();
 //end of workaround
 $parser->parse($u, $data);
 //Since IDK which namespace the documents contains, lets use the uri requested
 $triples = $parser->getTriples();
 $first = true;
 $c = 0;
开发者ID:sahilshekhawat,项目名称:owlviz,代码行数:31,代码来源:rdf2json.php

示例12: parse

 /**
  * Parse RDF, either from a string or a URL
  */
 public function parse($url)
 {
     $parser = @ARC2::getRDFXMLParser();
     if (stristr($url, '<rdf')) {
         $parser->parse(confirm_slash(base_url()), $url);
         // Parse an existing string
     } else {
         @$parser->parse($url);
         // Go out and get via the URL
     }
     $index = $parser->getSimpleIndex(0);
     return $index;
 }
开发者ID:paulshannon,项目名称:scalar,代码行数:16,代码来源:RDF_Store.php

示例13: add_rdfxml

 /**
  * Add the triples parsed from the supplied RDF/XML to the graph
  * @param string $rdfxml the RDF/XML to parse
  * @param string $base the base URI against which relative URIs in the RDF/XML document will be resolved
  */
 public function add_rdfxml($rdfxml, $base = '')
 {
     if ($rdfxml) {
         /** @var \ARC2_RDFXMLParser $parser */
         $parser = \ARC2::getRDFXMLParser();
         $parser->parse($base, $rdfxml);
         $this->_add_arc2_triple_list($parser->getTriples());
         unset($parser);
     }
 }
开发者ID:talis,项目名称:tripod-php,代码行数:15,代码来源:ExtendedGraph.class.php

示例14: parse_results_xml

 /**
  * Parse the results of a search on the contentbox.
  * @param string uri the URI used to obtain the search
  * @param string xml the xml returned from a search request
  * @return ResourceList
  */
 function parse_results_xml($uri, $xml)
 {
     // fix up unprefixed rdf:resource in rss 1.0 otherwise ARC gets confused
     $xml = preg_replace("~rdf:li resource=~", "rdf:li rdf:resource=", $xml);
     $parser_args = array("bnode_prefix" => "genid", "base" => $this->uri);
     $resources = new ResourceList();
     $resources->items = array();
     $parser = ARC2::getRDFXMLParser($parser_args);
     $parser->parse($this->uri, $xml);
     $triples = $parser->getTriples();
     $index = ARC2::getSimpleIndex($triples, true);
     $resources->title = $index[$uri][RSS_TITLE][0];
     $resources->description = $index[$uri][RSS_DESCRIPTION][0];
     $resources->start_index = $index[$uri][OS_STARTINDEX][0];
     $resources->items_per_page = $index[$uri][OS_ITEMSPERPAGE][0];
     $resources->total_results = $index[$uri][OS_TOTALRESULTS][0];
     $items_resource = $index[$uri][RSS_ITEMS][0];
     foreach ($index[$items_resource] as $items_property => $items_property_value) {
         if (strpos($items_property, 'http://www.w3.org/1999/02/22-rdf-syntax-ns#_') === 0) {
             $resources->items[] = $index[$items_property_value[0]];
         }
     }
     return $resources;
 }
开发者ID:risis-eu,项目名称:RISIS_LinkedDataAPI,代码行数:30,代码来源:contentbox.class.php

示例15: insertRDF

 static function insertRDF($uri, $graph, $endpoint)
 {
     self::deleteTriples($uri, $graph, $endpoint);
     //READ NEW TRIPLES WITH THE SUBJECT $uri
     $parser = @ARC2::getRDFXMLParser();
     @$parser->parse($uri);
     $err = $parser->getErrors();
     if ($err) {
         throw new Exception(self::buildMessage($err));
     }
     $newTriples = @$parser->getTriples();
     for ($i = 0, $i_max = count($newTriples); $i < $i_max; $i++) {
         if ($uri != $newTriples[$i]['s']) {
             unset($newTriples[$i]);
         }
     }
     /* Serializer instantiation */
     $ser = @new FourStore_NTriplesSerializer();
     /* Serialize a triples array */
     $doc = @$ser->getSerializedTriples($newTriples, 1);
     self::insert($doc, $graph, $endpoint);
 }
开发者ID:klaffenboeck,项目名称:contextus,代码行数:22,代码来源:SparqlTools.php


注:本文中的ARC2::getRDFXMLParser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。