From: Richard C. <ri...@cy...> - 2006-04-11 11:45:23
|
Hi Yang, On 11 Apr 2006, at 10:47, =EC=96=91=EA=B2=BD=EC=95=84 wrote: > I am a new user from RDFAPI-PHP and I can 't assume a owl to read. > I want to mount all of classes, properties and instances defined in =20= > owl file to memory. > Exactly, I can load the file but don 't know how I can get the =20 > classes, properties and instances. > > OntModel only supports the API, listClasses() to get classes. Am I =20= > right?? > listClasses() returns Resource data type. How can I change =20 > Resource to OntClass.. If the resource returned by listClasses() has a URI, then you can use =20= $ontModel->createOntClass($uri) to retrieve a matching OntClass =20 object. I don't know if it is possible with an anonymous class. OntModel also has createOntProperty and createIndividual methods. Hope that helps, Richard > > This is the part of code to get classes in owl file. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > //create new memory model > $ontModel =3D ModelFactory::getOntModel(MEMMODEL,RDFS_VOCABULARY); > > //load the parse document > $ontModel->load(ROOT_DIRECTORY."software.owl"); > > // load classes > $array =3D $ontModel->listClasses(" http://ozzy.cbnu.ac.kr/ontology/ = "); > > foreach( $array as $resource ){ > > echo $resouce->getLabel(); > > // How can I get the classes, properties and instances ?? > > } > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > I'll very happy if you give me a answer > Thank you. > Yang. |