本文整理汇总了PHP中QueryBuilder::generateQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::generateQuery方法的具体用法?PHP QueryBuilder::generateQuery怎么用?PHP QueryBuilder::generateQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::generateQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCorrectQueryWithInputAndFilter
public function testCorrectQueryWithInputAndFilter()
{
// Arrange
$a = new QueryBuilder("1", "TZW:Test");
// Assert
$this->assertEquals(preg_replace('/\\s+/', ' ', '
PREFIX uri: <http://192.168.238.133/index.php/Speciaal:URIResolver/>
PREFIX skos: <http://192.168.238.133/index.php/Speciaal:URIResolver/Eigenschap-3ASkos-3A>
PREFIX skosem: <http://192.168.238.133/index.php/Speciaal:URIResolver/Eigenschap-3ASkosem-3A>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
construct { ?s ?p ?o }
where {
?c rdfs:label "TZW:ThisTest" .
?c (skosem:narrower){,3} ?s .
?s ?p ?o
FILTER(EXISTS { ?s a uri:Categorie-3ASKOS_Concept } )
}
'), preg_replace('/\\s+/', ' ', $a->generateQuery("false,true", "3", "TZW:ThisTest")));
}
示例2: QueryBuilder
<?php
include_once __DIR__ . '/QueryBuilder.class.php';
include_once __DIR__ . '/DataParser.class.php';
include_once __DIR__ . '/visitor/NodeMapVisitor.class.php';
// Load data
$querybuilder = new QueryBuilder($_POST["depth"], $_POST["concept"]);
$query = $querybuilder->generateQuery($_POST["relations"]);
$result = file_get_contents('http://localhost:3030/ds/query?output=json&query=' . urlencode($query));
// Parse data
$parser = new DataParser(json_decode($result, true));
$objects = $parser->parseDataRDF();
// Handle data
$visitor = new NodeMapVisitor();
foreach ($objects as $object) {
$object->accept($visitor);
}
// Return JSON
echo $visitor->getUsableJSON();