really basic question about store and a local file
From: Fabrizio
Subject: really basic question about store and a local file
Date: Sat, 7 Mar 2009 22:21:28 +0100
--Apple-Mail-1-455650608
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit
Sorry, I'm a real beginner...
I don't know if it's possible to use the code like this
prova.ttl is a file with:
@prefix cd: <http://example.org/cd/> .
@prefix : <http://example.org/esempio/> .
:Permutation cd:autore "Amon Tobin" .
:Bricolage cd:autore "Amon Tobin" .
:Amber cd:autore "Autechre" .
:Amber cd:anno 1994 .
The script is:
(SPARQL e TURTLE are validated, php is correct, the database is
created')
rows are empty and it seems not reading prova.ttl
include_once("../arc/ARC2.php");
$config = array(
/* db */
'db_name' => 'movedb',
'db_user' => 'root',
'db_pwd' => 'root',
/* store */
'store_name' => 'arc_tests',
);
$store = ARC2::getStore($config);
if (!$store->isSetUp()) {
$store->setUp();
}
$q = '
PREFIX cd: <http://example.org/cd/>
SELECT ?titolo
FROM <http://localhost:8888/MAMP/mostra/prova.ttl>
WHERE {?titolo cd:autore ?autore}
';
$rs = $store->query($q);
if (!$store->getErrors()) {
print_r($rs['result']['rows']);
$rows = $rs['result']['rows'];
} else {
print_r($store->getErrors());
echo "errore";
}
--Apple-Mail-1-455650608
Content-Type: text/html;
charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">Sorry, I'm a real =
beginner... <div><br></div><div>I don't know if it's possible to =
use the code like this</div><div><br></div><div>prova.ttl is a file =
with:</div><div><br></div><div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; "><i>@prefix cd: <<a =
href=3D"http://example.org/cd/">http://example.org/cd/</a>> =
..</i></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; "><i>@prefix : <<a =
href=3D"http://example.org/esempio/">http://example.org/esempio/</a>> =
..</i></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; "><i>:Permutation cd:autore "Amon Tobin" =
..</i></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; "><i>:Bricolage cd:autore "Amon Tobin" =
..</i></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; "><i>:Amber cd:autore "Autechre" .</i></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
"><i>:Amber cd:anno 1994 .</i></div></div><div><br></div><div>The script =
is:</div><div>(SPARQL e TURTLE are validated, php is correct, the =
database is created')</div><div>rows are empty and it seems not reading =
prova.ttl</div><div><br><div><br></div><div><div><i>include_once("../arc/A=
RC2.php");</i></div><div><i><br></i></div><div><i>$config =3D =
array(</i></div><div><i> /* db =
*/</i></div><div><i> 'db_name' =3D> =
'movedb',</i></div><div><i> 'db_user' =3D> =
'root',</i></div><div><i> 'db_pwd' =3D> =
'root',</i></div><div><i> /* store =
*/</i></div><div><i> 'store_name' =3D> =
'arc_tests',</i></div><div><i>);</i></div><div><i>$store =3D =
ARC2::getStore($config);</i></div><div><i>if (!$store->isSetUp()) =
{</i></div><div><i> $store->setUp();</i></div><div><i>}</i></di=
v><div><i><br></i></div><div><i>$q =3D '</i></div><div><i>PREFIX cd: =
<<a =
href=3D"http://example.org/cd/">http://example.org/cd/</a>></i></div><div>=
<i>SELECT ?titolo</i></div><div><i>FROM <<a =
href=3D"http://localhost:8888/MAMP/mostra/prova.ttl">http://localhost:8888=
/MAMP/mostra/prova.ttl</a>></i></div><div><i>WHERE {?titolo cd:autore =
?autore}</i></div><div><i>';</i></div><div><i><br></i></div><div><i><br></=
i></div><div><i>$rs =3D $store->query($q);</i></div><div><i>if =
(!$store->getErrors()) =
{</i></div><div><i><br></i></div><div><i><br></i></div><div><i>print_r($rs=
['result']['rows']);</i></div><div><i><br></i></div><div><i><br></i></div>=
<div><i> $rows =3D =
$rs['result']['rows'];</i></div><div><i><br></i></div><div><i> } =
else =
{</i></div><div><i>print_r($store->getErrors());</i></div><div><i><br></i>=
</div><div><i>echo =
"errore";</i></div><div><i>}</i></div><div><br></div><div><br></div></div>=
</div></body></html>=
--Apple-Mail-1-455650608--
""" ;
ns1:returnPath "<fabrizio@oceanfrontwalk.net>" ;
ns1:xOriginalTo "arc-dev@semsol.org" ;
ns1:deliveredTo "web11p1@p15192371.pureserver.info" ;
ns1:received """from [192.168.1.2] (87.18.21.27) by vsmtp2.tin.it (8.0.022)
id 49443D3F052B10E6 for arc-dev@semsol.org; Sat, 7 Mar 2009 22:21:50 +0100""" ;
ns1:messageId "<70A6CFBE-D796-4D00-9ED0-18BE75F6A9C1@oceanfrontwalk.net>" ;
ns1:from "Fabrizio <fabrizio@oceanfrontwalk.net>" ;
ns1:to "arc-dev@semsol.org" ;
ns1:contentType "multipart/alternative; boundary=Apple-Mail-1-455650608" ;
ns1:mimeVersion "1.0 (Apple Message framework v924)" ;
ns1:subject "really basic question about store and a local file" ;
ns1:date "Sat, 7 Mar 2009 22:21:28 +0100" ;
ns1:xMailer "Apple Mail (2.924)" ;
ns1:xSpamCheckerVersion """SpamAssassin 2.64 (2004-01-11) on
p15192371.pureserver.info""" ;
ns1:xSpamLevel "" ;
ns1:xSpamStatus """No, hits=0.8 required=5.0 tests=AWL,BAYES_44,HTML_50_60,
HTML_MESSAGE,WEIRD_PORT autolearn=no version=2.64