|
From: <cw...@us...> - 2007-08-13 06:06:05
|
Revision: 499
http://rdfapi-php.svn.sourceforge.net/rdfapi-php/?rev=499&view=rev
Author: cweiske
Date: 2007-08-12 23:06:02 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
N3 parsing test script
Added Paths:
-----------
trunk/rdfapi-php/test/parseN3.php
Added: trunk/rdfapi-php/test/parseN3.php
===================================================================
--- trunk/rdfapi-php/test/parseN3.php (rev 0)
+++ trunk/rdfapi-php/test/parseN3.php 2007-08-13 06:06:02 UTC (rev 499)
@@ -0,0 +1,36 @@
+<?php
+/**
+* Small script to try out our N3 parser.
+* Simply call it with the file to parse as parameter.
+*
+* @author Christian Weiske <cw...@cw...>
+*/
+if ($argc <= 1) {
+ echo <<<EOT
+Parses an N3 ("turtle") file
+ Usage: php parseN3.php /path/to/file.n3
+
+EOT;
+ exit(1);
+}
+
+$file = $argv[1];
+if (!file_exists($file)) {
+ echo <<<EOT
+File does not exist.
+ Usage: php parseN3.php /path/to/file.n3
+
+EOT;
+ exit(2);
+}
+
+
+require_once 'config.php';
+require_once RDFAPI_INCLUDE_DIR . 'syntax/N3Parser.php';
+
+$parser = new N3Parser();
+$parser->parse(
+ file_get_contents($file)
+);
+
+?>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|