예제 #1
0
<?php

/**
 * --- GR4PHP (GoodRelations FOR PHP) ---
 * An easy example to include GR4PHP-API in your website
 * 
 * @author	Martin Anding, Stefan Dietrich, Alex Stolz (University of German Armed Forces Munich)
 * 			API is a result of a study project in "GoodRelations" in the year of 2010.
 * 			This work is based on the GoodRelations ontology, developed by Martin Hepp.
 * @link    http://purl.org/goodrelations/
 * @license GNU LESSER GENERAL PUBLIC LICENSE
 * @version 1.0
 * 
 */
// Requirements: the following two include tags
include_once '../gr4php.php';
include_once '../gr4php_configuration.php';
// first instruction: Instantiation of GR4PHP-Class
$gr4php = new GR4PHP(Configuration::ENDPOINT_URIBURNER);
// second instruction: Select function, input array, wanted elements, mode and limt
print_r($gr4php->getStore(array("title" => "Team EWS Ingenieure"), FALSE, ":lax", 30));
예제 #2
0
function getFunction($endpoint, $function, $inputArray, $wantedElements = NULL, $mode = NULL, $limit = 20)
{
    $gr4php = new GR4PHP($endpoint);
    switch ($function) {
        case "getStore":
            $result = $gr4php->getStore($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
        case "getCompany":
            $result = $gr4php->getCompany($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
        case "getProductModel":
            $result = $gr4php->getProductModel($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
        case "getOffers":
            $result = $gr4php->getOffers($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
        case "getOpeningHours":
            $result = $gr4php->getOpeningHours($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
        case "getLocation":
            $result = $gr4php->getLocation($inputArray, $wantedElements, $mode, $limit);
            $query = $gr4php->printSparqlQuery();
            break;
    }
    return array($result, $query);
}