diff --git a/common.inc.php b/common.inc.php new file mode 100644 index 0000000000000000000000000000000000000000..84a21eccf2858613fe3242bf905909075f771937 --- /dev/null +++ b/common.inc.php @@ -0,0 +1,44 @@ +<? +include_once('settings.inc.php'); + +$conf['endpoint']['config']['output'] = 'json'; +$conf['endpoint']['config']['named_graph'] = ''; +$conf['endpoint']['config']['show_inline'] = 0; + +$conf['metaendpoint']['config']['output'] = 'json'; +$conf['metaendpoint']['config']['show_inline'] = 0; +$conf['metaendpoint']['config']['named_graph'] = 'http://slodps.org/metadata'; + + +$conf['ns']['rdf'] = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; +$conf['ns']['rdfs'] = 'http://www.w3.org/2000/01/rdf-schema#'; +$conf['ns']['dcterms'] = 'http://purl.org/dc/terms/'; +$conf['ns']['foaf'] = 'http://xmlns.com/foaf/0.1/'; +$conf['ns']['skos'] = 'http://www.w3.org/2004/02/skos/core#'; +$conf['ns']['og'] = 'http://opengraphprotocol.org/schema/'; +$conf['ns']['owl'] = 'http://www.w3.org/2002/07/owl#'; +$conf['ns']['ov'] = 'http://open.vocab.org/terms/'; +$conf['ns']['conv'] = 'http://purl.org/twc/vocab/conversion/'; + +$conf['model']['directory'] = 'models/'; #include trailing slash! +$conf['model']['extension'] = '.model'; +$conf['model']['default'] = 'default'; + +$conf['view']['directory'] = 'views/'; #include trailing slash! +$conf['view']['extension'] = '.view'; +$conf['view']['default'] = 'default'; +$conf['view']['standard']['baseUrl'] = $conf['basedir']; + +$conf['resource']['url_delimiter'] = "%u"; + +$conf['http_accept']['text/html'] = 'html'; +$conf['http_accept']['application/rdf+xml'] = 'rdf'; +$conf['http_accept']['text/turtle'] = 'ttl'; +$conf['http_accept']['text/plain'] = 'nt'; + /* TODO: more generalizable formats + 'xhtml' => 'application/xhtml+xml', + 'xml' => 'application/xml', + 'n3' => 'text/n3', + */ +$conf['http_accept']['default'] = 'html'; +?> diff --git a/endpoint.php b/endpoint.php index 84b9dfa08f154e9bda4662e2410409d6425b6e45..912d36093e09528a65886e74d522e26f716fdb2d 100644 --- a/endpoint.php +++ b/endpoint.php @@ -1,14 +1,16 @@ <?php /* ARC2 static class inclusion */ include_once('lib/arc2/ARC2.php'); +include_once('settings.inc.php'); set_time_limit(0); + /* MySQL and endpoint configuration */ $config = array( /* db */ - 'db_host' => 'localhost', /* optional, default is localhost */ - 'db_name' => 'slodp', - 'db_user' => 'sl', - 'db_pwd' => 'ls', + 'db_host' => $conf['metaendpoint']['config']['host'], + 'db_name' => $conf['metaendpoint']['config']['dbname'], + 'db_user' => $conf['metaendpoint']['config']['user'], + 'db_pwd' => $conf['metaendpoint']['config']['pass'], /* store name */ 'store_name' => 'my_endpoint_store', @@ -20,8 +22,8 @@ $config = array( 'dump' /* dump is a special command for streaming SPOG export */ ), 'endpoint_timeout' => 60, /* not implemented in ARC2 preview */ - 'endpoint_read_key' => '', /* optional */ - 'endpoint_write_key' => '5A9av7zuDA3', /* optional */ + 'endpoint_read_key' => '', + 'endpoint_write_key' => $conf['metaendpoint']['config']['key'], 'endpoint_max_limit' => 0 ); diff --git a/example b/example.ttl similarity index 100% rename from example rename to example.ttl diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..1c7f21ae6949c4dfebe94913bb4e2ef2868ca65d --- /dev/null +++ b/install.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +mysql_port="3360" +mysql_host="localhost" +mysql_user="root" +mysql_pass="" + +basedir="http://localhost/" +ns=$basedir +endpoint="http://localhost/sparql?" +everything_ok="n" + +while [ "$everything_ok" != "y" ] +do + echo "==Basic Information==" + echo "slodps needs to gather some basic information first to configure the installation properly" + echo -n "Type the base url of your site where slodps' index.php will be located (default '$basedir'): " + read aux_basedir + echo "" + if [ "$aux_basedir" != "" ] + then + basedir=$aux_basedir + fi + + echo -n "Type the local namespace you will use (default '$ns'): " + read aux_ns + echo "" + if [ "$aux_ns" != "" ] + then + ns=$aux_ns + fi + + echo -n "What is the URL of your SPARQL endpoint? (default $endpoint): " + read aux_endpoint + echo "" + if [ "$aux_endpoint" != "" ] + then + endpoint=$aux_endpoint + fi + + echo "==Internal SPARQL endpoint==" + echo "slodps reads from your SPARQL endpoint, however it needs to add metadata to its own SPARQL endpoint" + echo "" + echo "Ok, to create slodps' endpoint I need a MySQL database" + echo -n "What is host where the database is located (default $mysql_host)? " + echo "" + read aux_mysql_host + if [ "$aux_mysql_host" != "" ] + then + mysql_host=$aux_mysql_host + fi + + echo -n "What is port the database is listening to (default $mysql_port)? " + read aux_mysql_port + echo "" + if [ "$aux_mysql_port" != "" ] + then + mysql_port=$aux_mysql_port + fi + + echo -n "What is user for this database (default $mysql_user)? " + read mysql_user + echo "" + if [ "$aux_mysql_user" != "" ] + then + mysql_user=$aux_mysql_user + fi + + echo -n "What is password for $mysql_user? " + read mysql_pass + echo "" + if [ "$aux_mysql_pass" != "" ] + then + mysql_pass=$aux_mysql_pass + fi + + echo "==Configuration==" + echo "Ok, so I have the following configuration:" + echo "slodps is installed at $basedir" + echo "The local namespace is $ns" + echo "Your SPARQL endpoint is located at $endpoint" + echo "For slodps internal sparql endpoint the configuration is as follows:" + echo "Host: $mysql_host" + echo "Port: $mysql_port" + echo "User: $mysql_user" + echo "Pass: $mysql_pass" + + echo -n "Is everything ok (y/n)?" + read everything_ok + +done