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


PHP ARC2::getTriplesFromIndex方法代码示例

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


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

示例1: extractRDF

 function extractRDF()
 {
     $tc = 0;
     $t = '';
     $t_vals = array();
     foreach ($this->nodes as $n) {
         if ($n['tag'] != 'a') {
             continue;
         }
         if (!($href = $this->v('href uri', '', $n['a']))) {
             continue;
         }
         if (!($rels = $this->v('rel m', array(), $n['a']))) {
             continue;
         }
         if (!($vals = array_intersect($this->terms, $rels))) {
             continue;
         }
         $parts = preg_match('/^(.*\\/)([^\\/]+)\\/?$/', $href, $m) ? array('space' => $m[1], 'tag' => rawurldecode($m[2])) : array('space' => '', 'tag' => '');
         if ($tag = $parts['tag']) {
             $t_vals['s_' . $tc] = $this->getContainerResIDByClass($n, $this->containers);
             $t_vals['concept_' . $tc] = $this->createBnodeID() . '_concept';
             $t_vals['tag_' . $tc] = $tag;
             $t_vals['space_' . $tc] = $parts['space'];
             $t .= '?s_' . $tc . ' skos:subject [skos:prefLabel ?tag_' . $tc . ' ; skos:inScheme ?space_' . $tc . '] . ';
             $tc++;
         }
     }
     $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
     $this->addTs(ARC2::getTriplesFromIndex($doc));
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:31,代码来源:ARC2_RelTagSkosExtractor.php

示例2: extractRDF

 function extractRDF()
 {
     $tc = 0;
     $t = '';
     $t_vals = array();
     foreach ($this->nodes as $n) {
         if ($n['tag'] != 'a') {
             continue;
         }
         if (!($href = $this->v('href uri', '', $n['a']))) {
             continue;
         }
         if (!($rels = $this->v('rel m', array(), $n['a']))) {
             continue;
         }
         if (!($vals = array_intersect($this->terms, $rels))) {
             continue;
         }
         if (in_array('category', $this->v('class m', array(), $n['a']))) {
             continue;
         }
         /* hcard/hcalendar categories */
         $parts = preg_match('/^(.*\\/)([^\\/]+)\\/?$/', $href, $m) ? array('space' => $m[1], 'tag' => rawurldecode($m[2])) : array('space' => '', 'tag' => '');
         if ($tag = $parts['tag']) {
             $t_vals['s_' . $tc] = $this->getContainerResIDByClass($n, $this->containers);
             $t_vals['tag_' . $tc] = $tag;
             $t .= '?s_' . $tc . ' dc:subject ?tag_' . $tc . ' . ';
             $tc++;
         }
     }
     $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
     $this->addTs(ARC2::getTriplesFromIndex($doc));
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:33,代码来源:ARC2_RelTagDcExtractor.php

示例3: extractRDF

 function extractRDF()
 {
     foreach ($this->nodes as $n) {
         if (!($vals = $this->v('class m', array(), $n['a']))) {
             continue;
         }
         if (!in_array('adr', $vals)) {
             continue;
         }
         /* node  */
         $t_vals = array('s' => $this->getResID($n, 'adr'));
         $t = '';
         /* context */
         list($t_vals, $t) = $this->extractContext($n, $t_vals, $t);
         /* properties */
         foreach ($this->terms as $term) {
             $m = 'extract' . $this->camelCase($term);
             if (method_exists($this, $m)) {
                 list($t_vals, $t) = $this->{$m}($n, $t_vals, $t);
             }
         }
         /* result */
         $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
         $this->addTs(ARC2::getTriplesFromIndex($doc));
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:26,代码来源:ARC2_AdrFoafExtractor.php

示例4: extractRDF

 function extractRDF()
 {
     $t_vals = array();
     $t = '';
     foreach ($this->nodes as $n) {
         if (isset($n['tag']) && $n['tag'] == 'link') {
             $m = 'extract' . ucfirst($n['tag']);
             list($t_vals, $t) = $this->{$m}($n, $t_vals, $t);
         }
     }
     if ($t) {
         $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
         $this->addTs(ARC2::getTriplesFromIndex($doc));
     }
 }
开发者ID:benblamey,项目名称:cmu-teaching-php,代码行数:15,代码来源:ARC2_OpenidExtractor.php

示例5: extractRDF

 function extractRDF()
 {
     $t_vals = array();
     $t = '';
     foreach ($this->nodes as $n) {
         if (isset($n['tag']) && $n['tag'] == 'img' && $this->v('id', '', $n['a']) == 'profile-image') {
             $t_vals['vcard_id'] = $this->getDocID($n) . '#resource(side/1/2/1)';
             $t .= '?vcard_id mf:photo <' . $n['a']['src'] . '> . ';
             break;
         }
     }
     if ($t) {
         $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
         $this->addTs(ARC2::getTriplesFromIndex($doc));
     }
 }
开发者ID:benblamey,项目名称:cmu-teaching-php,代码行数:16,代码来源:ARC2_TwitterProfilePicExtractor.php

示例6: extractRDF

 function extractRDF()
 {
     foreach ($this->nodes as $n) {
         if (!($vals = $this->v('class m', array(), $n['a']))) {
             continue;
         }
         if (!in_array('vevent', $vals)) {
             continue;
         }
         /* vevent  */
         $t_vals = array('s' => $this->getResID($n, 'vevent') . '_event', 's_type' => $this->a['ns']['cal'] . 'Vevent');
         $t = ' ?s a ?s_type . ';
         /* properties */
         foreach ($this->terms as $term) {
             $m = 'extract' . $this->camelCase($term);
             if (method_exists($this, $m)) {
                 list($t_vals, $t) = $this->{$m}($n, $t_vals, $t);
             }
         }
         /* result */
         $doc = $this->getFilledTemplate($t, $t_vals, $n['doc_base']);
         $this->addTs(ARC2::getTriplesFromIndex($doc));
     }
 }
开发者ID:helenadeus,项目名称:s3db.map,代码行数:24,代码来源:ARC2_HcalendarExtractor.php

示例7: deleteConstructedGraph

 function deleteConstructedGraph()
 {
     ARC2::inc('StoreConstructQueryHandler');
     $h =& new ARC2_StoreConstructQueryHandler($this->a, $this->store);
     $sub_r = $h->runQuery($this->infos);
     $triples = ARC2::getTriplesFromIndex($sub_r);
     $tgs = $this->infos['query']['target_graphs'];
     $this->infos = array('query' => array('construct_triples' => $triples, 'target_graphs' => $tgs));
     return $this->deleteTriples();
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:10,代码来源:ARC2_StoreDeleteQueryHandler.php

示例8: toTriples

 function toTriples($v)
 {
     if (is_array($v)) {
         if (isset($v[0]) && isset($v[0]['s'])) {
             return $v;
         }
         return ARC2::getTriplesFromIndex($v);
     }
     $parser = ARC2::getRDFParser($this->a);
     if ($v && !preg_match('/\\s/', $v)) {
         /* assume graph URI */
         $parser->parse($v);
     } else {
         $parser->parse('', $v);
     }
     return $parser->getTriples();
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:17,代码来源:ARC2_Class.php

示例9: extractRDF

 function extractRDF()
 {
     $index = $this->getNodeIndex();
     //print_r($index);
     $this->rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
     $this->atom = 'http://www.w3.org/2005/atom';
     $this->rss = 'http://purl.org/rss/1.0/';
     $this->dc = 'http://purl.org/dc/elements/1.1/';
     $this->dct = 'http://purl.org/dc/terms/';
     $this->content = 'http://purl.org/rss/1.0/modules/content/';
     $this->enc = 'http://purl.oclc.org/net/rss_2.0/enc#';
     $this->mappings = array('feed' => $this->rss . 'channel', 'entry' => $this->rss . 'item', 'title' => $this->rss . 'title', 'link' => $this->rss . 'link', 'summary' => $this->rss . 'description', 'content' => $this->content . 'encoded', 'id' => $this->dc . 'identifier', 'author' => $this->dc . 'creator', 'category' => $this->dc . 'subject', 'updated' => $this->dc . 'date', 'source' => $this->dc . 'source');
     $this->dt_props = array($this->dc . 'identifier', $this->rss . 'link');
     foreach ($index as $p_id => $nodes) {
         foreach ($nodes as $pos => $node) {
             $tag = $this->v('tag', '', $node);
             if ($tag == 'feed') {
                 $struct = $this->extractChannel($index[$node['id']]);
                 $triples = ARC2::getTriplesFromIndex($struct);
                 foreach ($triples as $t) {
                     $this->addT($t);
                 }
             } elseif ($tag == 'entry') {
                 $struct = $this->extractItem($index[$node['id']]);
                 $triples = ARC2::getTriplesFromIndex($struct);
                 foreach ($triples as $t) {
                     $this->addT($t);
                 }
             }
         }
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:32,代码来源:ARC2_AtomParser.php

示例10: getTriplesForSubject

 /**
  * Get all triples with a given subject
  * @param string $subjecturi
  * @return array $triples
  */
 function getTriplesForSubject( $subjecturi ) {
     $reconstructedIndex = array( $subjecturi => $this->m_tripleindex[$subjecturi] );
     $triples = ARC2::getTriplesFromIndex( $reconstructedIndex );
     return $triples;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:SMWBatchWriter.php

示例11: executeNonEditSparqlQuery

 /**
  * Execute method for SPARQL queries that only queries and returns results, but
  * does not modify, add or delete triples.
  */
 function executeNonEditSparqlQuery()
 {
     global $wgOut;
     $output = $this->passSparqlToARC2AndGetAsPhpSerialization();
     $outputtype = $this->determineOutputType();
     if ($outputtype == 'rdfxml') {
         # Here the results should be RDF/XML triples,
         # not just plain XML SPARQL result set
         $output_structure = unserialize($output);
         $tripleindex = $output_structure['result'];
         $triples = ARC2::getTriplesFromIndex($tripleindex);
         if ($this->requestdata->outputequivuris) {
             // FIXME: Why is this uncommented???
             # $triples = $this->complementTriplesWithEquivURIsForProperties( $triples );
             $triples = $this->complementTriplesWithEquivURIs($triples);
         }
         $output = $this->triplesToRDFXML($triples);
         # Using echo instead of $wgOut->addHTML() here, since output format is not HTML
         echo $output;
     } else {
         // TODO: Add some kind of check that the output is really an object
         if (count($output) > 0) {
             $output_structure = unserialize($output);
             if ($this->requestdata->outputequivuris) {
                 $output_structure = $this->urisToEquivURIsInSparqlResults($output_structure);
             }
             if ($outputtype == 'htmltab') {
                 $output = $this->sparqlResultToHTML($output_structure);
                 $wgOut->addHTML($output);
             } else {
                 # Using echo instead of $wgOut->addHTML() here, since output format is not HTML
                 $output = $this->sparqlendpoint->getSPARQLXMLSelectResultDoc($output_structure);
                 echo $output;
             }
         } else {
             $wgOut->setHTML("ERROR: No results from SPARQL query!");
         }
     }
 }
开发者ID:rdfio,项目名称:RDFIO,代码行数:43,代码来源:SpecialSPARQLEndpoint_body.php

示例12: execute

    /**
     * The main function
     */
    function execute() {
        global $wgRequest, $wgOut, $wgUser;

        $this->setHeaders();
        $this->handleRequestData();

        $executesparql = true;

        if ( $this->m_query == '' ) {
            $this->printHTMLForm();
        } else {
            $this->ensureSparqlEndpointInstalled();
            $this->convertURIsInQuery();

            if ( $this->m_querytype == 'insert' ) { // TODO
                if ( $this->checkAllowInsert() ) {
                    $this->importTriplesInQuery();
                }
                $this->printHTMLForm();
            } elseif ( $this->m_querytype == 'delete' ) {
                if ( $this->checkAllowDelete() ) {
                    $this->deleteTriplesInQuery();
                }
                // TODO Add a "successfully inserted/deleted" message here
                $this->printHTMLForm();
            } else { // We are querying/outputting data, not editing

                if ( $this->m_outputtype == 'htmltab' ) {
                    $this->printHTMLForm();
                    if ( $wgRequest->getBool( 'showquery', false ) ) {
                        $this->printQueryStructure();
                        $executesparql = false;
                    }
                } elseif ( $this->m_outputtype == 'rdfxml' && $this->m_querytype != 'construct' ) {
                    $errormessage = "RDF/XML can only be used with CONSTRUCT, if constructing triples";
                    $wgOut->addHTML( RDFIOUtils::formatErrorHTML( "Invalid choice", $errormessage ) );
                    $this->printHTMLForm();
                    $executesparql = false;
                } else {
                    $this->prepareCreatingDownloadableFile();
                }

                if ( $executesparql ) {
                    $outputtype = $this->m_outputtype;
                    if ( $outputtype == '' && $this->m_querytype == 'construct' ) {
                        $outputtype = 'rdfxml';
                    }
                    if ( $outputtype == 'rdfxml' || $outputtype == 'xml' || $outputtype == '' ) {
                        // Make sure that ARC outputs data in a format that we can
                        // easily work with programmatically
                        $this->setOutputTypeInPost( 'php_ser' );
                    }

                    // Pass on the request handling to ARC2:s SPARQL Endpoint
                    $this->m_sparqlendpoint->handleRequest();
                    $this->handleSPARQLErrors();
                    $output = $this->m_sparqlendpoint->getResult();

                    if ( $outputtype == 'htmltab' ) {
                        if ( $this->m_outputoriguris ) {
                            $output = $this->convertURIsToOrigURIsInText( $output );
                        }
                        $output = $this->extractPrepareARCHTMLOutput( $output );
                        $wgOut->addHTML( $output );
                    } elseif ( $outputtype == 'rdfxml' ) {
                        $output_structure = unserialize( $output );
                        $tripleindex = $output_structure['result'];
                        $triples = ARC2::getTriplesFromIndex( $tripleindex );
                        if ( $this->m_outputoriguris ) {
                            $triples = $this->convertURIsToOrigURIsInTriples( $triples );
                        }
                        if ( $this->m_outputequivuris ) {
                            # $triples = $this->complementTriplesWithEquivURIsForProperties( $triples );
                            if ( $this->m_filtervocab && ( $this->m_filtervocaburl != '' ) ) {
                                $vocab_p_uri_filter = $this->getVocabPropertyUriFilter();
                                $triples = $this->complementTriplesWithEquivURIs( $triples, $vocab_p_uri_filter );
                            } else {
                                $triples = $this->complementTriplesWithEquivURIs( $triples );
                            }
                        }
                        $output = $this->triplesToRDFXML( $triples );
                        echo $output;
                    } else {
                        $output_structure = unserialize( $output );
                        if ( $this->m_outputoriguris ) {
                            $output_structure = $this->convertURIsToOrigURIsInSPARQLResultSet( $output_structure );
                        }
                        if ( $this->m_outputequivuris ) {
                            $vocab_p_uri_filter = $this->getVocabPropertyUriFilter();
                            $output_structure = $this->complementSPARQLResultRowsWithEquivURIs( $output_structure, $vocab_p_uri_filter );
                        }
                        $output = $this->m_sparqlendpoint->getSPARQLXMLSelectResultDoc( $output_structure );
                        echo $output;
                    }
                }
            }
        }
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SpecialSPARQLEndpoint_body.php

示例13: get_triples

 /**
  * @deprecated this is deprecated
  */
 function get_triples()
 {
     return ARC2::getTriplesFromIndex($this->_to_arc_index($this->_index));
 }
开发者ID:asavagar,项目名称:EU-data-cloud,代码行数:7,代码来源:simplegraph.class.php


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