Mailing list ARC-DEV: Archives

FW: [arc-dev] ARC Newbie - Load Rdf Files into array but fail to get the triples value

From: M San 
Subject: FW: [arc-dev] ARC Newbie - Load Rdf Files into array but fail to
 get the triples value
Date: Sat, 30 Jan 2010 18:46:52 +0800


--_586b9d1d-f396-452e-b093-eac88314c3fa_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable



Hi Benji=2C

Thanks a lot for the answer.=20
However=2C i have some problem in storing the triples into ARC triple store=
.
I manage to store it into table in MySQL but i am confused on how to load t=
he triples into ARC2 triple store.
I keep on getting the error "The ARC2 triple store is currently empty.
Please load some data first."
For the ARC store name=2Cis it must be the same as the table name in mysql?

I tried the following code as well but i got the error of "parse error". Ca=
n the store->query() be used to load the local rdf files?

store->query('LOAD <file:///Documents and Settings/user/Desktop/protege.owl=
>')=3B

Thanks in advanced for the answer

Regards=2C
M San

> To: arc-dev@semsol.org
> Subject: Re: [arc-dev] ARC Newbie - Load Rdf Files into array but fail to=
 get the triples value
> Date: Fri=2C 29 Jan 2010 14:22:55 +0100
> From: bnowack@semsol.com
>=20
>=20
>=20
>=20
> Hi and welcome!
>=20
>=20
>=20
> In order to see the triple structure=2C you'd have to replace "echo"
>=20
> with "print_r". Each triple is an array=2C not a plain string=2C e.g.:
>=20
>=20
>=20
> foreach ($triples as $i =3D> $triple) {
>=20
>    print_r($triple)=3B
>=20
>    echo "\nsubject: " . $triple['s']=3B
>=20
> }
>=20
>=20
>=20
> Re 2): there is no in-memory SPARQL engine yet. For now=2C you have
>=20
> to put the triples into the RDFStore (requires MySQL) first before
>=20
> you can run SPARQL queries. In-Memory sparqling is on the todo list=2C
>=20
> but I don't know when I'll find the time to implement it.
>=20
>=20
>=20
> Cheers=2C
>=20
> Benji
>=20
>=20
>=20
> --
>=20
> Benjamin Nowack
>=20
> http://bnode.org/
>=20
> http://semsol.com/
>=20
>=20
>=20
> On 29.01.2010 18:35:59=2C M San wrote:
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >Hello=2C
>=20
> >
>=20
> >I'm newbie in using ARC with php. I have some problems in using ARC and =
=3D
> i do really
>=20
> >hope someone can help me with this.
>=20
> >
>=20
> >1) I need to load the local RDF files and store the triples into array =
=3D
> so that i
>=20
> >can query the triples from the array.=20
>=20
> >    But when i display the value in the array=2C i got the results of =
=3D
> "Array" instead
>=20
> >of the triples value. Below is the code(partially).
>=20
> >    Could you please let me know which part of the coding went wrong?
>=20
> >   =20
>=20
> >$parser =3D ARC2::getRDFParser()=3B
>=20
> >$data =3D '<rdf:RDF =3D
> xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#"=20
>=20
> >    xmlns:protege=3D"http://protege.stanford.edu/plugins/owl/protege#"=20
>=20
> >    xmlns:xsp=3D"http://www.owl-ontologies.com/2005/08/07/xsp.owl#"=20
>=20
> >    xmlns:owl=3D"http://www.w3.org/2002/07/owl#"
>=20
> >    xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema#"
>=20
> >    xmlns:swrl=3D"http://www.w3.org/2003/11/swrl#"
>=20
> >    xmlns:swrlb=3D"http://www.w3.org/2003/11/swrlb#"
>=20
> >    xmlns=3D"http://www.owl-ontologies.com/Ontology1261493587.owl#"
>=20
> >    xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#"
>=20
> >  xml:base=3D"http://www.owl-ontologies.com/Ontology1261493587.owl">
>=20
> >  <owl:Ontology rdf:about=3D""/>
>=20
> >  <owl:Class rdf:ID=3D"IAS">
>=20
> >    <rdfs:subClassOf>
>=20
> >      <owl:Class rdf:ID=3D"OccupationCode"/>
>=20
> >    </rdfs:subClassOf>
>=20
> >    <rdfs:subClassOf>
>=20
> >      <owl:Restriction>
>=20
> >        <owl:onProperty>
>=20
> >          <owl:ObjectProperty rdf:ID=3D"hasOccupationType"/>
>=20
> >        </owl:onProperty>
>=20
> >        <owl:someValuesFrom>
>=20
> >          <owl:Class>
>=20
> >            <owl:unionOf rdf:parseType=3D"Collection">
>=20
> >              <owl:Class rdf:ID=3D"DictionaryEditor"/>
>=20
> >              <owl:Class rdf:ID=3D"ArtAppraiser"/>
>=20
> >              <owl:Class rdf:ID=3D"Economist"/>
>=20
> >              <owl:Class rdf:ID=3D"Psychiatrist"/>
>=20
> >              <owl:Class rdf:ID=3D"Philologist"/>
>=20
> >              <owl:Class rdf:ID=3D"DentalHygienist"/>
>=20
> >            </owl:unionOf>
>=20
> >          </owl:Class>
>=20
> >        </owl:someValuesFrom>
>=20
> >      </owl:Restriction>
>=20
> >    </rdfs:subClassOf>
>=20
> >  </owl:Class>
>=20
> ></rdf:RDF>'=3B
>=20
> >$parser->parse(''=2C$data)=3B
>=20
> >$triples =3D $parser->getTriples()=3B
>=20
> >
>=20
> >for ($i=3D0=2C $i_max =3D count($triples)=3B $i < $i_max=3B $i++)
>=20
> >{
>=20
> >    $triple =3D $triples[$i]=3B
>=20
> >     echo $triple=3B
>=20
> >   =20
>=20
> >}
>=20
> >
>=20
> >2) How to use Sparql to query the triples in the array? Is it possible =
=3D
> to do that?
>=20
> >
>=20
> >Thanks in advance for the answers.
>=20
> >M San
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> >
>=20
> > 		 	   		 =20
>=20
> >_________________________________________________________________
>=20
> >Hotmail: Powerful Free email with security by Microsoft.
>=20
> >https://signup.live.com/signup.aspx?id=3D60969
>=20
>=20
>=20
 		 	   		 =20
_________________________________________________________________
Hotmail: Trusted email with Microsoft=92s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=3D60969=

--_586b9d1d-f396-452e-b093-eac88314c3fa_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
..hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 10pt=3B
font-family:Verdana
}
--></style>
</head>
<body class=3D'hmmessage'>
<br>Hi Benji=2C<br><br>Thanks a lot for the answer. <br>However=2C i have s=
ome problem in storing the triples into ARC triple store.<br>I manage to st=
ore it into table in MySQL but i am confused on how to load the triples int=
o ARC2 triple store.<br>I keep on getting the error "<strong>The ARC2 tripl=
e store is currently empty.
Please load some data first."</strong><br>For the ARC store name=2Cis it mu=
st be the same as the table name in mysql?<br><br>I tried the following cod=
e as well but i got the error of "parse error". Can the store-&gt=3Bquery()=
 be used to load the local rdf files?<br><br>store-&gt=3Bquery('LOAD &lt=3B=
file:///Documents and Settings/user/Desktop/protege.owl&gt=3B')=3B<br><br>T=
hanks in advanced for the answer<br><br>Regards=2C<br>M San<br><br>&gt=3B T=
o: arc-dev@semsol.org<br>&gt=3B Subject: Re: [arc-dev] ARC Newbie - Load Rd=
f Files into array but fail to get the triples value<br>&gt=3B Date: Fri=2C=
 29 Jan 2010 14:22:55 +0100<br>&gt=3B From: bnowack@semsol.com<br>&gt=3B <b=
r>&gt=3B <br>&gt=3B <br>&gt=3B <br>&gt=3B Hi and welcome!<br>&gt=3B <br>&gt=
=3B <br>&gt=3B <br>&gt=3B In order to see the triple structure=2C you'd hav=
e to replace "echo"<br>&gt=3B <br>&gt=3B with "print_r". Each triple is an =
array=2C not a plain string=2C e.g.:<br>&gt=3B <br>&gt=3B <br>&gt=3B <br>&g=
t=3B foreach ($triples as $i =3D&gt=3B $triple) {<br>&gt=3B <br>&gt=3B    p=
rint_r($triple)=3B<br>&gt=3B <br>&gt=3B    echo "\nsubject: " . $triple['s'=
]=3B<br>&gt=3B <br>&gt=3B }<br>&gt=3B <br>&gt=3B <br>&gt=3B <br>&gt=3B Re 2=
): there is no in-memory SPARQL engine yet. For now=2C you have<br>&gt=3B <=
br>&gt=3B to put the triples into the RDFStore (requires MySQL) first befor=
e<br>&gt=3B <br>&gt=3B you can run SPARQL queries. In-Memory sparqling is o=
n the todo list=2C<br>&gt=3B <br>&gt=3B but I don't know when I'll find the=
 time to implement it.<br>&gt=3B <br>&gt=3B <br>&gt=3B <br>&gt=3B Cheers=2C=
<br>&gt=3B <br>&gt=3B Benji<br>&gt=3B <br>&gt=3B <br>&gt=3B <br>&gt=3B --<b=
r>&gt=3B <br>&gt=3B Benjamin Nowack<br>&gt=3B <br>&gt=3B http://bnode.org/<=
br>&gt=3B <br>&gt=3B http://semsol.com/<br>&gt=3B <br>&gt=3B <br>&gt=3B <br=
>&gt=3B On 29.01.2010 18:35:59=2C M San wrote:<br>&gt=3B <br>&gt=3B &gt=3B<=
br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=
=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=
=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3BHello=2C<br>&gt=3B <br>&gt=
=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3BI'm newbie in using ARC with php. I h=
ave some problems in using ARC and =3D<br>&gt=3B i do really<br>&gt=3B <br>=
&gt=3B &gt=3Bhope someone can help me with this.<br>&gt=3B <br>&gt=3B &gt=
=3B<br>&gt=3B <br>&gt=3B &gt=3B1) I need to load the local RDF files and st=
ore the triples into array =3D<br>&gt=3B so that i<br>&gt=3B <br>&gt=3B &gt=
=3Bcan query the triples from the array. <br>&gt=3B <br>&gt=3B &gt=3B    Bu=
t when i display the value in the array=2C i got the results of =3D<br>&gt=
=3B "Array" instead<br>&gt=3B <br>&gt=3B &gt=3Bof the triples value. Below =
is the code(partially).<br>&gt=3B <br>&gt=3B &gt=3B    Could you please let=
 me know which part of the coding went wrong?<br>&gt=3B <br>&gt=3B &gt=3B  =
  <br>&gt=3B <br>&gt=3B &gt=3B$parser =3D ARC2::getRDFParser()=3B<br>&gt=3B=
 <br>&gt=3B &gt=3B$data =3D '&lt=3Brdf:RDF =3D<br>&gt=3B xmlns:rdf=3D"http:=
//www.w3.org/1999/02/22-rdf-syntax-ns#" <br>&gt=3B <br>&gt=3B &gt=3B    xml=
ns:protege=3D"http://protege.stanford.edu/plugins/owl/protege#" <br>&gt=3B =
<br>&gt=3B &gt=3B    xmlns:xsp=3D"http://www.owl-ontologies.com/2005/08/07/=
xsp.owl#" <br>&gt=3B <br>&gt=3B &gt=3B    xmlns:owl=3D"http://www.w3.org/20=
02/07/owl#"<br>&gt=3B <br>&gt=3B &gt=3B    xmlns:xsd=3D"http://www.w3.org/2=
001/XMLSchema#"<br>&gt=3B <br>&gt=3B &gt=3B    xmlns:swrl=3D"http://www.w3.=
org/2003/11/swrl#"<br>&gt=3B <br>&gt=3B &gt=3B    xmlns:swrlb=3D"http://www=
..w3.org/2003/11/swrlb#"<br>&gt=3B <br>&gt=3B &gt=3B    xmlns=3D"http://www.=
owl-ontologies.com/Ontology1261493587.owl#"<br>&gt=3B <br>&gt=3B &gt=3B    =
xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#"<br>&gt=3B <br>&gt=3B &=
gt=3B  xml:base=3D"http://www.owl-ontologies.com/Ontology1261493587.owl"&gt=
=3B<br>&gt=3B <br>&gt=3B &gt=3B  &lt=3Bowl:Ontology rdf:about=3D""/&gt=3B<b=
r>&gt=3B <br>&gt=3B &gt=3B  &lt=3Bowl:Class rdf:ID=3D"IAS"&gt=3B<br>&gt=3B =
<br>&gt=3B &gt=3B    &lt=3Brdfs:subClassOf&gt=3B<br>&gt=3B <br>&gt=3B &gt=
=3B      &lt=3Bowl:Class rdf:ID=3D"OccupationCode"/&gt=3B<br>&gt=3B <br>&gt=
=3B &gt=3B    &lt=3B/rdfs:subClassOf&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B    &=
lt=3Brdfs:subClassOf&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B      &lt=3Bowl:Restr=
iction&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B        &lt=3Bowl:onProperty&gt=3B<=
br>&gt=3B <br>&gt=3B &gt=3B          &lt=3Bowl:ObjectProperty rdf:ID=3D"has=
OccupationType"/&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B        &lt=3B/owl:onProp=
erty&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B        &lt=3Bowl:someValuesFrom&gt=
=3B<br>&gt=3B <br>&gt=3B &gt=3B          &lt=3Bowl:Class&gt=3B<br>&gt=3B <b=
r>&gt=3B &gt=3B            &lt=3Bowl:unionOf rdf:parseType=3D"Collection"&g=
t=3B<br>&gt=3B <br>&gt=3B &gt=3B              &lt=3Bowl:Class rdf:ID=3D"Dic=
tionaryEditor"/&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B              &lt=3Bowl:Cl=
ass rdf:ID=3D"ArtAppraiser"/&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B             =
 &lt=3Bowl:Class rdf:ID=3D"Economist"/&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B   =
           &lt=3Bowl:Class rdf:ID=3D"Psychiatrist"/&gt=3B<br>&gt=3B <br>&gt=
=3B &gt=3B              &lt=3Bowl:Class rdf:ID=3D"Philologist"/&gt=3B<br>&g=
t=3B <br>&gt=3B &gt=3B              &lt=3Bowl:Class rdf:ID=3D"DentalHygieni=
st"/&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B            &lt=3B/owl:unionOf&gt=3B<=
br>&gt=3B <br>&gt=3B &gt=3B          &lt=3B/owl:Class&gt=3B<br>&gt=3B <br>&=
gt=3B &gt=3B        &lt=3B/owl:someValuesFrom&gt=3B<br>&gt=3B <br>&gt=3B &g=
t=3B      &lt=3B/owl:Restriction&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B    &lt=
=3B/rdfs:subClassOf&gt=3B<br>&gt=3B <br>&gt=3B &gt=3B  &lt=3B/owl:Class&gt=
=3B<br>&gt=3B <br>&gt=3B &gt=3B&lt=3B/rdf:RDF&gt=3B'=3B<br>&gt=3B <br>&gt=
=3B &gt=3B$parser-&gt=3Bparse(''=2C$data)=3B<br>&gt=3B <br>&gt=3B &gt=3B$tr=
iples =3D $parser-&gt=3BgetTriples()=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=
=3B <br>&gt=3B &gt=3Bfor ($i=3D0=2C $i_max =3D count($triples)=3B $i &lt=3B=
 $i_max=3B $i++)<br>&gt=3B <br>&gt=3B &gt=3B{<br>&gt=3B <br>&gt=3B &gt=3B  =
  $triple =3D $triples[$i]=3B<br>&gt=3B <br>&gt=3B &gt=3B     echo $triple=
=3B<br>&gt=3B <br>&gt=3B &gt=3B    <br>&gt=3B <br>&gt=3B &gt=3B}<br>&gt=3B =
<br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B2) How to use Sparql to query =
the triples in the array? Is it possible =3D<br>&gt=3B to do that?<br>&gt=
=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3BThanks in advance for the =
answers.<br>&gt=3B <br>&gt=3B &gt=3BM San<br>&gt=3B <br>&gt=3B &gt=3B<br>&g=
t=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=
=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&gt=3B &gt=3B<br>&gt=3B <br>&=
gt=3B &gt=3B 		 	   		  <br>&gt=3B <br>&gt=3B &gt=3B_______________________=
__________________________________________<br>&gt=3B <br>&gt=3B &gt=3BHotma=
il: Powerful Free email with security by Microsoft.<br>&gt=3B <br>&gt=3B &g=
t=3Bhttps://signup.live.com/signup.aspx?id=3D60969<br>&gt=3B <br>&gt=3B <br=
>&gt=3B <br> 		 	   		  <br /><hr />Hotmail: Trusted email with Microsoft=
=92s powerful SPAM protection. <a href=3D'https://signup.live.com/signup.as=
px?id=3D60969' target=3D'_new'>Sign up now.</a></body>
</html>=

--_586b9d1d-f396-452e-b093-eac88314c3fa_--

""" ;
         ns1:returnPath "<vice_ms_wong@hotmail.com>" ;
         ns1:xOriginalTo "arc-dev@semsol.org" ;
         ns1:deliveredTo "web11p1@p15192371.pureserver.info" ;
         ns1:received """from BLU134-W20 ([65.55.116.8]) by blu0-omc1-s1.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959);
	 Sat, 30 Jan 2010 02:46:52 -0800""" ;
         ns1:messageID "<BLU134-W20953577DF97AA16BE47B2D95A0@phx.gbl>" ;
         ns1:contentType '''multipart/alternative;
	boundary="_586b9d1d-f396-452e-b093-eac88314c3fa_"''' ;
         ns1:xOriginatingIP "[58.26.217.95]" ;
         ns1:from "M San <vice_ms_wong@hotmail.com>" ;
         ns1:to "<arc-dev@semsol.org>" ;
         ns1:subject """FW: [arc-dev] ARC Newbie - Load Rdf Files into array but fail to
 get the triples value""" ;
         ns1:date "Sat, 30 Jan 2010 18:46:52 +0800" ;
         ns1:importance "Normal" ;
         ns1:inReplyTo "<PM-GA.20100129142255.B53DB.1.1D@semsol.com>" ;
         ns1:references """
 <BLU134-W3CAE2806ADB392D9DB496D95B0@phx.gbl>,<PM-GA.20100129142255.B53DB.1.1D@semsol.com>""" ;
         ns1:mIMEVersion "1.0" ;
         ns1:xOriginalArrivalTime "30 Jan 2010 10:46:52.0362 (UTC) FILETIME=[886132A0:01CAA199]" ;
         ns1:xSpamCheckerVersion """SpamAssassin 2.64 (2004-01-11) on 
	p15192371.pureserver.info""" ;
         ns1:xSpamLevel "" ;
         ns1:xSpamStatus """No, hits=0.2 required=5.0 tests=AWL,BAYES_20,HTML_MESSAGE 
	autolearn=ham version=2.64