Last active
August 29, 2015 14:03
-
-
Save njh/4e6f78939f3cb0a33c81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib/'); | |
require_once "EasyRdf.php"; | |
EasyRdf_Namespace::set('ont', 'http://www.semanticweb.org/augunipov/ontologies/m_ontology#'); | |
$graph = new EasyRdf_Graph(); | |
$graph->parseFile('29138.ttl', 'turtle'); | |
echo "<ul>\n"; | |
foreach($graph->allOfType('ont:Book') as $book) { | |
if (preg_match('/Yankee/i', $book->get('ont:bookHasTitle'))) { | |
echo "<li>Author: ".$book->get("^ont:authorHasAuthorshipOfBook/ont:authorName")."</li>\n"; | |
} | |
} | |
echo "</ul>\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@prefix ont: <http://www.semanticweb.org/augunipov/ontologies/m_ontology#> . | |
<http://example.com/author1> | |
a ont:Author; | |
ont:authorName "Mary Ann Rodman"; | |
ont:authorHasAuthorshipOfBook <http://example.com/book1> . | |
<http://example.com/author2> | |
a ont:Author; | |
ont:authorName "William Boyd"; | |
ont:authorHasAuthorshipOfBook <http://example.com/book2> . | |
<http://example.com/author3> | |
a ont:Author; | |
ont:authorName "felipezkn"; | |
ont:authorHasAuthorshipOfBook <http://example.com/book3> . | |
<http://example.com/book1> | |
a ont:Book; | |
ont:bookhasIsbn <urn:isbn:0746067496>; | |
ont:bookHasTitle "Yankee Girl" . | |
<http://example.com/book2> | |
a ont:Book; | |
ont:bookhasIsbn <urn:isbn:0140093478>; | |
ont:bookHasTitle "On the yankee station" . | |
<http://example.com/book3> | |
a ont:Book; | |
ont:bookHasTitle "How to run a query against a local RDF file" . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment