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


PHP EasyRdf_Format::register方法代码示例

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


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

示例1: __construct

 public function __construct(EasyRdf_Graph $graph = null)
 {
     if ($graph === null) {
         $graph = new EasyRdf_Graph();
     }
     $this->graph = $graph;
     $this->uriGenerators = array();
     EasyRdf_Format::register('rdfxml', 'RDF/XML', 'http://www.w3.org/TR/rdf-syntax-grammar', 'application/rdf+xml');
     //EasyRdf_Format::registerParser( 'rdfxml', 'EasyRdf_Parser_RdfXml');
     EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_RdfXml');
 }
开发者ID:Tjoosten,项目名称:kvd,代码行数:11,代码来源:AbstractSerialiser.class.php

示例2: array

   NOTE: they are ordered by preference
*/
EasyRdf_Format::register('php', 'RDF/PHP', 'http://n2.talis.com/wiki/RDF_PHP_Specification');
EasyRdf_Format::register('json', 'RDF/JSON Resource-Centric', 'http://n2.talis.com/wiki/RDF_JSON_Specification', array('application/json' => 1.0, 'text/json' => 0.9, 'application/rdf+json' => 0.9), array('json'));
EasyRdf_Format::register('ntriples', 'N-Triples', 'http://www.w3.org/TR/rdf-testcases/#ntriples', array('text/plain' => 1.0, 'text/ntriples' => 0.9, 'application/ntriples' => 0.9, 'application/x-ntriples' => 0.9), array('nt'));
EasyRdf_Format::register('turtle', 'Turtle Terse RDF Triple Language', 'http://www.dajobe.org/2004/01/turtle', array('text/turtle' => 0.8, 'application/turtle' => 0.7, 'application/x-turtle' => 0.7), array('ttl'));
EasyRdf_Format::register('rdfxml', 'RDF/XML', 'http://www.w3.org/TR/rdf-syntax-grammar', array('application/rdf+xml' => 0.8), array('rdf', 'xrdf'));
EasyRdf_Format::register('dot', 'Graphviz', 'http://www.graphviz.org/doc/info/lang.html', array('text/vnd.graphviz' => 0.8), array('gv', 'dot'));
EasyRdf_Format::register('json-triples', 'RDF/JSON Triples');
EasyRdf_Format::register('n3', 'Notation3', 'http://www.w3.org/2000/10/swap/grammar/n3#', array('text/n3' => 0.5, 'text/rdf+n3' => 0.5), array('n3'));
EasyRdf_Format::register('rdfa', 'RDFa', 'http://www.w3.org/TR/rdfa-core/', array('text/html' => 0.4, 'application/xhtml+xml' => 0.4), array('html'));
EasyRdf_Format::register('sparql-xml', 'SPARQL XML Query Results', 'http://www.w3.org/TR/rdf-sparql-XMLres/', array('application/sparql-results+xml' => 1.0));
EasyRdf_Format::register('sparql-json', 'SPARQL JSON Query Results', 'http://www.w3.org/TR/rdf-sparql-json-res/', array('application/sparql-results+json' => 1.0));
EasyRdf_Format::register('png', 'Portable Network Graphics (PNG)', 'http://www.w3.org/TR/PNG/', array('image/png' => 0.3), array('png'));
EasyRdf_Format::register('gif', 'Graphics Interchange Format (GIF)', 'http://www.w3.org/Graphics/GIF/spec-gif89a.txt', array('image/gif' => 0.2), array('gif'));
EasyRdf_Format::register('svg', 'Scalable Vector Graphics (SVG)', 'http://www.w3.org/TR/SVG/', array('image/svg+xml' => 0.3), array('svg'));
/*
   Register default set of parsers and serialisers
*/
EasyRdf_Format::registerParser('json', 'EasyRdf_Parser_Json');
EasyRdf_Format::registerParser('ntriples', 'EasyRdf_Parser_Ntriples');
EasyRdf_Format::registerParser('php', 'EasyRdf_Parser_RdfPhp');
EasyRdf_Format::registerParser('rdfxml', 'EasyRdf_Parser_RdfXml');
EasyRdf_Format::registerParser('turtle', 'EasyRdf_Parser_Turtle');
EasyRdf_Format::registerParser('rdfa', 'EasyRdf_Parser_Rdfa');
EasyRdf_Format::registerSerialiser('json', 'EasyRdf_Serialiser_Json');
EasyRdf_Format::registerSerialiser('n3', 'EasyRdf_Serialiser_Turtle');
EasyRdf_Format::registerSerialiser('ntriples', 'EasyRdf_Serialiser_Ntriples');
EasyRdf_Format::registerSerialiser('php', 'EasyRdf_Serialiser_RdfPhp');
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_RdfXml');
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Turtle');
开发者ID:ASDAFF,项目名称:myprofile,代码行数:31,代码来源:Format.php

示例3: array

        <>  a ldp:DirectContainer, foaf:Document ;
            foaf:primaryTopic :dataset ;
            ldp:membershipResource :dataset ;
            ldp:hasMemberRelation void:dataDump ;
            ldp:insertedContentRelation foaf:primaryTopic ;
            
        .
        :dataset a void:Dataset, prov:Entity ;
            prov:wasGeneratedBy [
                a prov:Activity ;
                prov:used <{queryResource}> ;
                prov:wasAssociatedWith :sparqlServerUser
            ]
        .
        :sparqlServerUser a foaf:Agent;
            foaf:account [
                a foaf:OnlineAccount ;
                foaf:accountServiceHomepage <{endpoint}> ;
                foaf:accountname "{username}" ;
            ]
        .
     ';
}
// fix a bug of Easy RDF
EasyRdf_Format::register('turtle', 'Turtle Terse RDF Triple Language', 'http://www.w3.org/TR/turtle/', array('text/turtle' => 1.0, 'application/turtle' => 0.7, 'application/x-turtle' => 0.7), array('ttl'));
$errorManager = BOTK\Core\ErrorManager::getInstance()->registerErrorHandler();
try {
    echo BOTK\Core\EndPointFactory::make('MyRouter')->run();
} catch (Exception $e) {
    echo $errorManager->render($e);
}
开发者ID:linkeddatacenter,项目名称:BOTK-rdf,代码行数:31,代码来源:index.php

示例4: __construct

    public function __construct()
    {
        require_once 'arc/ARC2.php';
    }
    /**
     * Serialise an EasyRdf_Graph into RDF format of choice.
     *
     * @param EasyRdf_Graph $graph   An EasyRdf_Graph object.
     * @param string        $format  The name of the format to convert to.
     * @param array         $options
     * @throws EasyRdf_Exception
     * @return string              The RDF in the new desired format.
     */
    public function serialise($graph, $format, array $options = array())
    {
        parent::checkSerialiseParams($graph, $format);
        if (array_key_exists($format, self::$supportedTypes)) {
            $className = self::$supportedTypes[$format];
        } else {
            throw new EasyRdf_Exception("EasyRdf_Serialiser_Arc does not support: {$format}");
        }
        $serialiser = ARC2::getSer($className);
        if ($serialiser) {
            return $serialiser->getSerializedIndex(parent::serialise($graph, 'php'));
        } else {
            throw new EasyRdf_Exception("ARC2 failed to get a {$className} serialiser.");
        }
    }
}
EasyRdf_Format::register('posh', 'poshRDF');
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:30,代码来源:Arc.php

示例5: testSerialiseByMime

 public function testSerialiseByMime()
 {
     EasyRdf_Format::registerSerialiser('mock', 'Mock_RdfSerialiser');
     EasyRdf_Format::register('mock', 'Mock', null, array('mock/mime' => 1.0));
     $graph = new EasyRdf_Graph();
     $this->assertEquals("<rdf></rdf>", $graph->serialise('mock/mime'));
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:7,代码来源:GraphTest.php

示例6: proc_open

        $process = proc_open(escapeshellcmd($this->_rapperCmd) . " --quiet " . " --input ntriples " . " --output " . escapeshellarg($format) . " - " . 'unknown://', $descriptorspec, $pipes, '/tmp', null);
        if (is_resource($process)) {
            // $pipes now looks like this:
            // 0 => writeable handle connected to child stdin
            // 1 => readable handle connected to child stdout
            // 2 => readable handle connected to child stderr
            fwrite($pipes[0], $ntriples);
            fclose($pipes[0]);
            $output = stream_get_contents($pipes[1]);
            fclose($pipes[1]);
            $error = stream_get_contents($pipes[2]);
            fclose($pipes[2]);
            // It is important that you close any pipes before calling
            // proc_close in order to avoid a deadlock
            $returnValue = proc_close($process);
            if ($returnValue) {
                throw new EasyRdf_Exception("Failed to convert RDF: " . $error);
            }
        } else {
            throw new EasyRdf_Exception("Failed to execute rapper command.");
        }
        return $output;
    }
}
// FIXME: do this automatically
EasyRdf_Format::register('dot', 'Graphviz');
EasyRdf_Format::register('json-triples', 'RDF/JSON Triples');
EasyRdf_Format::registerSerialiser('dot', 'EasyRdf_Serialiser_Rapper');
EasyRdf_Format::registerSerialiser('json-triples', 'EasyRdf_Serialiser_Rapper');
EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Rapper');
EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Rapper');
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:Rapper.php

示例7: newSerialiser

    public function newSerialiser()
    {
        $serialiserClass = $this->_serialiserClass;
        if (!$serialiserClass) {
            throw new EasyRdf_Exception("No serialiser class available for format: " . $this->getName());
        }
        return new $serialiserClass();
    }
    /** Magic method to return the name of the format when casted to string
     *
     * @return string The name of the format
     */
    public function __toString()
    {
        return $this->_name;
    }
}
/*
   Register default set of supported formats
   NOTE: they are ordered by preference
*/
EasyRdf_Format::register('php', 'RDF/PHP', 'http://n2.talis.com/wiki/RDF_PHP_Specification');
EasyRdf_Format::register('json', 'RDF/JSON Resource-Centric', 'http://n2.talis.com/wiki/RDF_JSON_Specification', array('application/json' => 1.0, 'text/json' => 0.9, 'application/rdf+json' => 0.9));
EasyRdf_Format::register('ntriples', 'N-Triples', 'http://www.w3.org/TR/rdf-testcases/#ntriples', array('text/plain' => 1.0, 'text/ntriples' => 0.9, 'application/ntriples' => 0.9, 'application/x-ntriples' => 0.9));
EasyRdf_Format::register('turtle', 'Turtle Terse RDF Triple Language', 'http://www.dajobe.org/2004/01/turtle', array('text/turtle' => 0.8, 'application/turtle' => 0.7, 'application/x-turtle' => 0.7));
EasyRdf_Format::register('rdfxml', 'RDF/XML', 'http://www.w3.org/TR/rdf-syntax-grammar', array('application/rdf+xml' => 0.8));
EasyRdf_Format::register('n3', 'Notation3', 'http://www.w3.org/2000/10/swap/grammar/n3#', array('text/n3' => 0.5, 'text/rdf+n3' => 0.5));
EasyRdf_Format::register('rdfa', 'RDF/A', 'http://www.w3.org/TR/rdfa/', array('text/html' => 0.4, 'application/xhtml+xml' => 0.4));
EasyRdf_Format::register('sparql-xml', 'SPARQL XML Query Results', 'http://www.w3.org/TR/rdf-sparql-XMLres/', array('application/sparql-results+xml' => 1.0));
EasyRdf_Format::register('sparql-json', 'SPARQL JSON Query Results', 'http://www.w3.org/TR/rdf-sparql-json-res/', array('application/sparql-results+json' => 1.0));
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:30,代码来源:Format.php

示例8: elseif

        } elseif ($a['o'] != $b['o']) {
            return strcmp($a['o'], $b['o']);
        } else {
            return 0;
        }
    }
    /**
     * Serialise an EasyRdf_Graph into an array of N-Triples objects
     *
     * @param object EasyRdf_Graph $graph   An EasyRdf_Graph object.
     * @param string  $format               The name of the format to convert to.
     * @return string                       The RDF in the new desired format.
     */
    public function serialise($graph, $format)
    {
        parent::checkSerialiseParams($graph, $format);
        $triples = array();
        foreach ($graph->toArray() as $resource => $properties) {
            foreach ($properties as $property => $values) {
                foreach ($values as $value) {
                    array_push($triples, array('s' => $this->ntriplesResource($resource), 'p' => "<" . $this->escapeString($property) . ">", 'o' => $this->ntriplesValue($value)));
                }
            }
        }
        // Sort the triples into a consistent order
        usort($triples, array($this, 'compareTriples'));
        return $triples;
    }
}
EasyRdf_Format::register('ntriples-array', 'PHP Array of Triples');
EasyRdf_Format::registerSerialiser('ntriples-array', 'EasyRdf_Serialiser_NtriplesArray');
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:NtriplesArray.php

示例9: testRegisterNameNonString

 public function testRegisterNameNonString()
 {
     $this->setExpectedException('InvalidArgumentException');
     EasyRdf_Format::register(array());
 }
开发者ID:nhukhanhdl,项目名称:easyrdf,代码行数:5,代码来源:FormatTest.php

示例10: newSerialiser

     * @return object The new serialiser object
     */
    public function newSerialiser()
    {
        $serialiserClass = $this->_serialiserClass;
        if (!$serialiserClass) {
            throw new EasyRdf_Exception("No serialiser class available for: " . $this->getName());
        }
        return new $serialiserClass();
    }
    /** Magic method to return the name of the format when casted to string
     *
     * @return string The name of the format
     */
    public function __toString()
    {
        return $this->_name;
    }
}
/*
   Register default set of supported formats
   NOTE: they are ordered by preference
*/
EasyRdf_Format::register('php', 'RDF/PHP', 'http://n2.talis.com/wiki/RDF_PHP_Specification');
EasyRdf_Format::register('json', 'RDF/JSON Resource-Centric', 'http://n2.talis.com/wiki/RDF_JSON_Specification', array('application/json', 'text/json', 'application/rdf+json'));
EasyRdf_Format::register('ntriples', 'N-Triples', 'http://www.w3.org/TR/rdf-testcases/#ntriples', array('text/plain', 'text/ntriples', 'application/ntriples', 'application/x-ntriples'));
EasyRdf_Format::register('turtle', 'Turtle Terse RDF Triple Language', 'http://www.dajobe.org/2004/01/turtle', array('text/turtle', 'application/turtle', 'application/x-turtle'));
EasyRdf_Format::register('rdfxml', 'RDF/XML', 'http://www.w3.org/TR/rdf-syntax-grammar', 'application/rdf+xml');
EasyRdf_Format::register('n3', 'Notation3', 'http://www.w3.org/2000/10/swap/grammar/n3#', array('text/n3'));
EasyRdf_Format::register('rdfa', 'RDF/A', 'http://www.w3.org/TR/rdfa/', array('text/html', 'application/xhtml+xml'));
开发者ID:nhukhanhdl,项目名称:easyrdf,代码行数:30,代码来源:Format.php

示例11: testRegisterNameNonString

 public function testRegisterNameNonString()
 {
     $this->setExpectedException('InvalidArgumentException', '$name should be a string and cannot be null or empty');
     EasyRdf_Format::register(array());
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:5,代码来源:FormatTest.php

示例12: testSerialiseByFormatObject

 public function testSerialiseByFormatObject()
 {
     $format = EasyRdf_Format::register('mock', 'Mock Format');
     $format->setSerialiserClass('Mock_RdfSerialiser');
     $graph = new EasyRdf_Graph();
     $this->assertSame("<rdf></rdf>", $graph->serialise($format));
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:7,代码来源:GraphTest.php

示例13: testGetExtensionNoDefault

 public function testGetExtensionNoDefault()
 {
     $format2 = EasyRdf_Format::register('my2', 'Other Format');
     $this->assertNull($format2->getDefaultExtension());
 }
开发者ID:gitter-badger,项目名称:mexproject,代码行数:5,代码来源:FormatTest.php


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