diff --git a/classes/Convert.php b/classes/Convert.php index 80c73d39b44627d34203a205fb74c9cce8eff410..d50e794c41b10b6ebcff0b4e4deaf9f57ef6a5da 100644 --- a/classes/Convert.php +++ b/classes/Convert.php @@ -1,6 +1,12 @@ <?php + +namespace uib\ub\loadspeakr; + //Based (but corrected) from http://www.php.net/manual/en/language.types.object.php#102735 +use Exception; +use stdClass; + final class Convert { # Convert a stdClass to an Array. static public function object_to_array(stdClass $Class){ @@ -106,4 +112,4 @@ final class Convert { } } -?> + diff --git a/classes/Endpoint.php b/classes/Endpoint.php index 1635424bd2da5b1c3c3a3542837601596f162738..69e2bd8b319c46716e9078eac5154d30bda2cbf1 100644 --- a/classes/Endpoint.php +++ b/classes/Endpoint.php @@ -1,6 +1,9 @@ <?php -class Endpoint{ +namespace uib\ub\loadspeakr; + + +class Endpoint { private $sparqlUrl; private $params; @@ -116,4 +119,3 @@ class Endpoint{ } -?> diff --git a/classes/Exporter.php b/classes/Exporter.php index 1586473138a59511ede120863b79c0e937f6fd61..7431b2ec4324fa37f6e7a99600cbcb07273478a8 100644 --- a/classes/Exporter.php +++ b/classes/Exporter.php @@ -1,8 +1,14 @@ <?php -class Exporter{ +namespace uib\ub\loadspeakr; + + +use ARC2; + +class Exporter { private $serialization; private $graph; + public function __construct(){ $this->serialization = ""; $this->graph = array(); @@ -190,10 +196,7 @@ class Exporter{ } - - require __DIR__ . '../vendor/semsol/arc2/ARC2.php'; $ser = ARC2::getTurtleSerializer(); - $sparqlComponent = $conf['basedir'].'sparqlComponent';//uniqid("_:b"); //echo $ser->getSerializedTriples($triples); //var_dump($this->getComponents($conf['home'].$conf['view']['directory'])); @@ -541,5 +544,3 @@ class Exporter{ return $files; } } - -?> diff --git a/classes/HTTPStatus.php b/classes/HTTPStatus.php index bcbefcfe26270478cea1f9ceee6c7d8d30c6d53b..579d6bbda781d33e1fb2326900366a43e18de620 100644 --- a/classes/HTTPStatus.php +++ b/classes/HTTPStatus.php @@ -1,6 +1,10 @@ <?php -class HTTPStatus{ +namespace uib\ub\loadspeakr; + +use stdClass; + +class HTTPStatus { public static function send303($uri, $ext){ header("HTTP/1.0 303 See Other"); @@ -58,5 +62,3 @@ class HTTPStatus{ } } } - -?> diff --git a/classes/Importer.php b/classes/Importer.php index f80a71b0fd845002113616e853855c2f3a1c5bdd..48a9ef3198bcbf86f91e7722eaeebdd7ac31027d 100644 --- a/classes/Importer.php +++ b/classes/Importer.php @@ -1,5 +1,10 @@ <?php +namespace uib\ub\loadspeakr; + +use ARC2; +use Exception; + define("LS", "http://lodspeakr.org/lda/"); define("SKOS", "http://www.w3.org/2004/02/skos/core#"); define("RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); @@ -8,10 +13,11 @@ define("CNT", "http://www.w3.org/2011/content#"); define("RDFS", "http://www.w3.org/2000/01/rdf-schema#"); define("FILE", "settings.inc.php"); -class Importer{ +class Importer { private $basedir; private $external_basedir; + public function run(){ set_time_limit(0); error_reporting(E_ERROR); @@ -29,7 +35,6 @@ class Importer{ } echo $this->external_basedir; - include_once __DIR__ . '../vendor/semsol/arc2/ARC2.php'; $parser = ARC2::getTurtleParser(); if(isset($_GET['import'])){ @@ -348,4 +353,3 @@ class Importer{ } -?> diff --git a/classes/Logging.php b/classes/Logging.php index 240049fe4ae2d2458ef32821190c46ed494c16f4..efbcc3f314d52c7264145c1ade449c5f55c0c25d 100644 --- a/classes/Logging.php +++ b/classes/Logging.php @@ -1,6 +1,9 @@ <?php -class Logging{ +namespace uib\ub\loadspeakr; + + +class Logging { public static function init(){ $logs = array(); @@ -128,7 +131,7 @@ class Logging{ fwrite($conf['logfile'], ", ".json_encode($log)); } } - + public static function createLogFile($url){ $oldtokens = array( ".", "/"); $newtokens = array("___DOT___", "___SLASH___"); diff --git a/classes/MetaDb.php b/classes/MetaDb.php index 428352e023d7c7dc63f0debe5f4465421c49e6d3..97d448cc3fa8afe71a14d4ddec7a67b73293ec3c 100644 --- a/classes/MetaDb.php +++ b/classes/MetaDb.php @@ -1,7 +1,13 @@ <?php +namespace uib\ub\loadspeakr; -class MetaDb{ + +use Exception; +use PDO; +use PDOException; + +class MetaDb { private $dbLocation; public function __construct($location){ @@ -44,5 +50,3 @@ class MetaDb{ } } - -?> diff --git a/classes/Queries.php b/classes/Queries.php index 6a9b14c8e82fa75a39b7e524e9b04f42dc3b7702..ece59d1b33e807b5bd9e1a7090eebce5029d0775 100644 --- a/classes/Queries.php +++ b/classes/Queries.php @@ -1,6 +1,11 @@ <?php -class Queries{ +namespace uib\ub\loadspeakr; + + +use Exception; + +class Queries { public static function uriExist($uri, $e){ $q = "ASK WHERE{ { @@ -110,4 +115,3 @@ QUERY; } -?> diff --git a/classes/Utils.php b/classes/Utils.php index 90ac310f2f493cf6e33a4b808089dd13839ae597..7e082224f00955c81dd70dfc265bfaeb67bd87c3 100644 --- a/classes/Utils.php +++ b/classes/Utils.php @@ -1,6 +1,14 @@ <?php -class Utils{ +namespace uib\ub\loadspeakr; + + +use ARC2; +use Exception; +use Haanga; +use stdClass; + +class Utils { public static function uri2curie($uri){ global $conf; @@ -185,7 +193,6 @@ class Utils{ $ser; $dPointer; $docs = Utils::travelTree($data); - require_once __DIR__ . '../vendor/semsol/arc2/ARC2.php'; $parser = ARC2::getRDFParser(); $triples = array(); @@ -488,7 +495,6 @@ class Utils{ } $query = Utils::addPrefixes($query); if(!empty($lodspk['transform_select_query']) && $lodspk['transform_select_query']==true){ - include_once __DIR__ . '../vendor/semsol/arc2/ARC2.php'; $parser = ARC2::getSPARQLParser(); $parser->parse($query); $sparqlConstruct = array(); @@ -813,5 +819,3 @@ class Utils{ return $localUri; } } - -?> diff --git a/composer.json b/composer.json index 68d0d165e40543353fcf87e5ebaaeacd6bdb0e25..806a4de6da8c037a2011601ba02c020ac15467db 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,10 @@ ], "require": { "semsol/arc2": "^2", - "symfony/http-foundation": "^5.3" + "symfony/http-foundation": "^5.3", + "ext-pdo": "*", + "ext-json": "*", + "ext-curl": "*" }, "config": { "sort-packages": true, diff --git a/index.php b/index.php index cebf6d55822657bf3680929888c90414f6717b24..78c247ad9c0ee0a06b43367f181078fd28d067b0 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,8 @@ <?php + +require_once __DIR__ . 'vendor/autoload.php'; + //Import if(isset($_GET['q']) && $_GET['q'] == 'import'){ include_once('classes/Importer.php');