Skip to content

Commit

Permalink
fixed latest coding style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni committed Feb 13, 2024
1 parent 0d7d007 commit 6174abb
Show file tree
Hide file tree
Showing 39 changed files with 119 additions and 119 deletions.
2 changes: 1 addition & 1 deletion examples/basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<body>

<?php
$foaf = \EasyRdf\Graph::newAndLoad('http://njh.me/foaf.rdf');
$foaf = EasyRdf\Graph::newAndLoad('http://njh.me/foaf.rdf');
$me = $foaf->primaryTopic();
?>

Expand Down
10 changes: 5 additions & 5 deletions examples/basic_sparql.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
require_once __DIR__.'/html_tag_helpers.php';

// Setup some additional prefixes for DBpedia
\EasyRdf\RdfNamespace::set('dbc', 'http://dbpedia.org/resource/Category:');
\EasyRdf\RdfNamespace::set('dbpedia', 'http://dbpedia.org/resource/');
\EasyRdf\RdfNamespace::set('dbo', 'http://dbpedia.org/ontology/');
\EasyRdf\RdfNamespace::set('dbp', 'http://dbpedia.org/property/');
EasyRdf\RdfNamespace::set('dbc', 'http://dbpedia.org/resource/Category:');
EasyRdf\RdfNamespace::set('dbpedia', 'http://dbpedia.org/resource/');
EasyRdf\RdfNamespace::set('dbo', 'http://dbpedia.org/ontology/');
EasyRdf\RdfNamespace::set('dbp', 'http://dbpedia.org/property/');

$sparql = new \EasyRdf\Sparql\Client('http://dbpedia.org/sparql');
$sparql = new EasyRdf\Sparql\Client('http://dbpedia.org/sparql');
?>
<html>
<head>
Expand Down
6 changes: 3 additions & 3 deletions examples/converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

$output_format_options = [];

foreach (\EasyRdf\Format::getFormats() as $format) {
foreach (EasyRdf\Format::getFormats() as $format) {
if ($format->getSerialiserClass()) {
$output_format_options[$format->getLabel()] = $format->getName();
}
Expand Down Expand Up @@ -65,15 +65,15 @@

if (isset($_REQUEST['uri']) || isset($_REQUEST['data'])) {
// Parse the input
$graph = new \EasyRdf\Graph($_REQUEST['uri']);
$graph = new EasyRdf\Graph($_REQUEST['uri']);
if (empty($_REQUEST['data'])) {
$graph->load($_REQUEST['uri'], $_REQUEST['input_format']);
} else {
$graph->parse($_REQUEST['data'], $_REQUEST['input_format'], $_REQUEST['uri']);
}

// Lookup the output format
$format = \EasyRdf\Format::getFormat($_REQUEST['output_format']);
$format = EasyRdf\Format::getFormat($_REQUEST['output_format']);

// Serialise to the new output format
$output = $graph->serialise($format);
Expand Down
2 changes: 1 addition & 1 deletion examples/dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<?php
if (isset($_REQUEST['uri'])) {
$graph = \EasyRdf\Graph::newAndLoad($_REQUEST['uri']);
$graph = EasyRdf\Graph::newAndLoad($_REQUEST['uri']);
if (isset($_REQUEST['format']) && 'text' == $_REQUEST['format']) {
echo '<pre>'.$graph->dump('text').'</pre>';
} else {
Expand Down
66 changes: 33 additions & 33 deletions examples/foafinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,58 +28,58 @@

<?php
if (isset($_REQUEST['uri'])) {
$graph = \EasyRdf\Graph::newAndLoad($_REQUEST['uri']);
$graph = EasyRdf\Graph::newAndLoad($_REQUEST['uri']);
if ('foaf:PersonalProfileDocument' == $graph->type()) {
$person = $graph->primaryTopic();
} elseif ('foaf:Person' == $graph->type()) {
$person = $graph->resource();
}
}

if (isset($person)) {
?>
if (isset($person)) {
?>

<dl>
<dt>Name:</dt><dd><?php echo $person->get('foaf:name'); ?></dd>
<dt>Homepage:</dt><dd><?php echo link_to($person->get('foaf:homepage')); ?></dd>
</dl>

<?php
echo "<h2>Known Persons</h2>\n";
echo "<ul>\n";
foreach ($person->all('foaf:knows') as $friend) {
$label = $friend->label();
if (!$label) {
$label = $friend->getUri();
}
echo "<h2>Known Persons</h2>\n";
echo "<ul>\n";
foreach ($person->all('foaf:knows') as $friend) {
$label = $friend->label();
if (!$label) {
$label = $friend->getUri();
}

if ($friend->isBNode()) {
echo "<li>$label</li>";
} else {
echo '<li>'.link_to_self($label, 'uri='.urlencode($friend)).'</li>';
}
}
echo "</ul>\n";
if ($friend->isBNode()) {
echo "<li>$label</li>";
} else {
echo '<li>'.link_to_self($label, 'uri='.urlencode($friend)).'</li>';
}
}
echo "</ul>\n";

echo "<h2>Interests</h2>\n";
echo "<ul>\n";
foreach ($person->all('foaf:interest') as $interest) {
$label = $interest->label();
if ($label) {
if ($interest->isBNode()) {
echo "<li>$label</li>";
} else {
echo '<li>'.$interest->htmlLink($label).'</li>';
}
}
echo "<h2>Interests</h2>\n";
echo "<ul>\n";
foreach ($person->all('foaf:interest') as $interest) {
$label = $interest->label();
if ($label) {
if ($interest->isBNode()) {
echo "<li>$label</li>";
} else {
echo '<li>'.$interest->htmlLink($label).'</li>';
}
echo "</ul>\n";
}
}
echo "</ul>\n";
}

if (isset($graph)) {
echo '<br />';
echo $graph->dump();
}
if (isset($graph)) {
echo '<br />';
echo $graph->dump();
}
?>
</body>
</html>
18 changes: 9 additions & 9 deletions examples/foafmaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
require_once __DIR__.'/html_tag_helpers.php';

if (isset($_REQUEST['enable_arc']) && $_REQUEST['enable_arc']) {
\EasyRdf\Format::registerSerialiser('ntriples', 'EasyRdf\Serialiser\Arc');
\EasyRdf\Format::registerSerialiser('posh', 'EasyRdf\Serialiser\Arc');
\EasyRdf\Format::registerSerialiser('rdfxml', 'EasyRdf\Serialiser\Arc');
\EasyRdf\Format::registerSerialiser('turtle', 'EasyRdf\Serialiser\Arc');
EasyRdf\Format::registerSerialiser('ntriples', 'EasyRdf\Serialiser\Arc');
EasyRdf\Format::registerSerialiser('posh', 'EasyRdf\Serialiser\Arc');
EasyRdf\Format::registerSerialiser('rdfxml', 'EasyRdf\Serialiser\Arc');
EasyRdf\Format::registerSerialiser('turtle', 'EasyRdf\Serialiser\Arc');
}

if (isset($_REQUEST['enable_rapper']) && $_REQUEST['enable_rapper']) {
\EasyRdf\Format::registerSerialiser('dot', 'EasyRdf\Serialiser\Rapper');
\EasyRdf\Format::registerSerialiser('rdfxml', 'EasyRdf\Serialiser\Rapper');
\EasyRdf\Format::registerSerialiser('turtle', 'EasyRdf\Serialiser\Rapper');
EasyRdf\Format::registerSerialiser('dot', 'EasyRdf\Serialiser\Rapper');
EasyRdf\Format::registerSerialiser('rdfxml', 'EasyRdf\Serialiser\Rapper');
EasyRdf\Format::registerSerialiser('turtle', 'EasyRdf\Serialiser\Rapper');
}

$format_options = [];
foreach (\EasyRdf\Format::getFormats() as $format) {
foreach (EasyRdf\Format::getFormats() as $format) {
if ($format->getSerialiserClass()) {
$format_options[$format->getLabel()] = $format->getName();
}
Expand Down Expand Up @@ -67,7 +67,7 @@

<?php
if (isset($_REQUEST['uri'])) {
$graph = new \EasyRdf\Graph();
$graph = new EasyRdf\Graph();

// 1st Technique
$me = $graph->resource($_REQUEST['uri'], 'foaf:Person');
Expand Down
2 changes: 1 addition & 1 deletion examples/graph_direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>

<?php
$graph = new \EasyRdf\Graph();
$graph = new EasyRdf\Graph();
$graph->addResource('http://example.com/joe', 'rdf:type', 'foaf:Person');
$graph->addLiteral('http://example.com/joe', 'foaf:name', 'Joe Bloggs');
$graph->addLiteral('http://example.com/joe', 'foaf:name', 'Joseph Bloggs');
Expand Down
4 changes: 2 additions & 2 deletions examples/graphstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

<?php
// Use a local SPARQL 1.1 Graph Store (eg RedStore)
$gs = new \EasyRdf\GraphStore('http://localhost:8080/data/');
$gs = new EasyRdf\GraphStore('http://localhost:8080/data/');

// Add the current time in a graph
$graph1 = new \EasyRdf\Graph();
$graph1 = new EasyRdf\Graph();
$graph1->add('http://example.com/test', 'rdfs:label', 'Test');
$graph1->add('http://example.com/test', 'dc:date', time());
$gs->insert($graph1, 'time.rdf');
Expand Down
6 changes: 3 additions & 3 deletions examples/graphviz.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
'SVG' => 'svg',
];

$format = \EasyRdf\Format::getFormat(
$format = EasyRdf\Format::getFormat(
isset($_REQUEST['format']) ? $_REQUEST['format'] : 'png'
);

// Construct a graph of three people
$graph = new \EasyRdf\Graph();
$graph = new EasyRdf\Graph();
$graph->set('foaf:knows', 'rdfs:label', 'knows');
$bob = $graph->resource('http://www.example.com/bob', 'foaf:Person');
$alice = $graph->resource('http://www.example.com/alice', 'foaf:Person');
Expand All @@ -42,7 +42,7 @@
$alice->add('foaf:knows', $carol);

// Create a GraphViz serialiser
$gv = new \EasyRdf\Serialiser\GraphViz();
$gv = new EasyRdf\Serialiser\GraphViz();
$gv->setUseLabels(isset($_REQUEST['ul']));
$gv->setOnlyLabelled(isset($_REQUEST['ol']));

Expand Down
2 changes: 1 addition & 1 deletion examples/httpget.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<?php
if (isset($_REQUEST['uri'])) {
$client = new \EasyRdf\Http\Client($_REQUEST['uri']);
$client = new EasyRdf\Http\Client($_REQUEST['uri']);
$client->setHeaders('Accept', $_REQUEST['accept']);
$response = $client->request(); ?>

Expand Down
4 changes: 2 additions & 2 deletions examples/open_graph_protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
require_once realpath(__DIR__.'/..').'/vendor/autoload.php';
require_once __DIR__.'/html_tag_helpers.php';

\EasyRdf\RdfNamespace::setDefault('og');
EasyRdf\RdfNamespace::setDefault('og');
?>
<html>
<head>
Expand All @@ -24,7 +24,7 @@
</head>
<body>
<?php
$doc = \EasyRdf\Graph::newAndLoad('https://www.rottentomatoes.com/m/oceans_eleven');
$doc = EasyRdf\Graph::newAndLoad('https://www.rottentomatoes.com/m/oceans_eleven');
if ($doc->image) {
echo content_tag('img', null, ['src' => $doc->image, 'class' => 'image']);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/parse_rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<?php
if (isset($_REQUEST['uri'])) {
$graph = \EasyRdf\Graph::newAndLoad($_REQUEST['uri'], 'rdfxml');
$graph = EasyRdf\Graph::newAndLoad($_REQUEST['uri'], 'rdfxml');
$channel = $graph->get('rss:channel', '^rdf:type');

echo '<p>Channel: '.link_to($channel->label(), $channel->get('rss:link'))."</p>\n";
Expand Down
6 changes: 3 additions & 3 deletions examples/serialise.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
*/
require_once realpath(__DIR__.'/..').'/vendor/autoload.php';

$graph = new \EasyRdf\Graph();
$graph = new EasyRdf\Graph();
$me = $graph->resource('http://www.example.com/joe#me', 'foaf:Person');
$me->set('foaf:name', 'Joseph Bloggs');
$me->set('foaf:title', 'Mr');
$me->set('foaf:nick', 'Joe');
$me->add('foaf:homepage', $graph->resource('http://example.com/joe/'));

// I made these up; they are not officially part of FOAF
$me->set('foaf:dateOfBirth', new \EasyRdf\Literal\Date('1980-09-08'));
$me->set('foaf:dateOfBirth', new EasyRdf\Literal\Date('1980-09-08'));
$me->set('foaf:height', 1.82);

$project = $graph->newBnode('foaf:Project');
Expand All @@ -38,7 +38,7 @@

<ul>
<?php
foreach (\EasyRdf\Format::getFormats() as $f) {
foreach (EasyRdf\Format::getFormats() as $f) {
if ($f->getSerialiserClass()) {
if ($f->getName() == $format) {
echo '<li><b>'.$f->getLabel()."</b></li>\n";
Expand Down
4 changes: 2 additions & 2 deletions examples/sparql_queryform.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
echo label_tag('endpoint');
echo text_field_tag('endpoint', 'http://dbpedia.org/sparql', ['size' => 80]).'<br />';
echo '<code>';
foreach (\EasyRdf\RdfNamespace::namespaces() as $prefix => $uri) {
foreach (EasyRdf\RdfNamespace::namespaces() as $prefix => $uri) {
echo "PREFIX $prefix: &lt;".htmlspecialchars($uri)."&gt;<br />\n";
}
echo '</code>';
Expand All @@ -53,7 +53,7 @@

<?php
if (isset($_REQUEST['endpoint']) && isset($_REQUEST['query'])) {
$sparql = new \EasyRdf\Sparql\Client($_REQUEST['endpoint']);
$sparql = new EasyRdf\Sparql\Client($_REQUEST['endpoint']);
try {
$results = $sparql->query($_REQUEST['query']);
if (isset($_REQUEST['text'])) {
Expand Down
10 changes: 5 additions & 5 deletions examples/zend_framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
require_once realpath(__DIR__.'/..').'/vendor/autoload.php';

// use the CURL based HTTP client adaptor
$client = new \Zend\Http\Client(
$client = new Zend\Http\Client(
null,
[
'adapter' => 'Zend\Http\Client\Adapter\Curl',
'keepalive' => true,
'useragent' => 'EasyRdf/zendtest',
]
);
\EasyRdf\Http::setDefaultHttpClient($client);
EasyRdf\Http::setDefaultHttpClient($client);
?>

<html>
Expand All @@ -35,17 +35,17 @@

<?php
// Load some sample data into a graph
$graph = new \EasyRdf\Graph('http://example.com/joe');
$graph = new EasyRdf\Graph('http://example.com/joe');
$joe = $graph->resource('http://example.com/joe#me', 'foaf:Person');
$joe->add('foaf:name', 'Joe Bloggs');
$joe->addResource('foaf:homepage', 'http://example.com/joe/');

// Store it in a local graphstore
$store = new \EasyRdf\GraphStore('http://localhost:8080/data/');
$store = new EasyRdf\GraphStore('http://localhost:8080/data/');
$store->replace($graph);

// Now make a query to the graphstore
$sparql = new \EasyRdf\Sparql\Client('http://localhost:8080/sparql/');
$sparql = new EasyRdf\Sparql\Client('http://localhost:8080/sparql/');
$result = $sparql->query('SELECT * WHERE {<http://example.com/joe#me> ?p ?o}');
echo $result->dump();
?>
Expand Down
Loading

0 comments on commit 6174abb

Please sign in to comment.