On 23/02/12 14:18, 月之子 wrote:
*Thanks for your favor , I have read in the OWL file successfully with
TDB as the way you told me .But there is another problem coming. But I
tried all the TDB API,can't found out how to read a already parsed TDB
databse into a OntModel, so I ask for help again, thanks a lot
sincerecly. I pick the file in the attachment.*
Get a model from the TDB datatset,
Dataset ds = TDBFactory.createDataset (...) ;
OntModel ontModel = ModelFactory.createOntologyModel(ontmodelspec,
ds.getDefaultModel) ;
*
*
*Another **problem **confusing me is that . As we all know ,
com.hp.hpl.jena.ontology.OntModel.listClasses() can list all the class
belonging to the OWL file , including the anonymous class ,such as
*-7b93d8f7:135a90fe2c4:-7d69 *what I want to know is that whether this
API list all the **anonymous classes in the whole file?
Try it and see! i think it does.
Since I will
also get anonymous classes, when list the objects of individual or list
the resource of classes . I don't want to miss information , so store
all the anonymous when my project meets during processing.However ,this
way makes sure the integrity of the data, while bring a lot redundant
data about the anonymous classes. I want to know that ,whether
OntModel.listClasses() can list all the anonymous classes. If it can ,I
have no need to parse the anonymous classes after this step of
**OntModel.listClasses()**.*
*
*
*There still a question ,when I create a RDFS file with given
information ,all the classes can be created correctly. But there seems
some problems on the Individual creation,this leads to that the new
created RDFS file contain all the classes without any individual
belonging to the new created file.I paste my code here *
*
*
*
*
*
*
OntModel NewModel = null;
Individual NewSubject =
NewModel.createIndividual(IndividualURI,NewModel.createResource(ClassURI));
Property NewProperty = NewModel.createProperty(PredicateURI);
Literal NewObject = NewModel.createResource(ObjectURI);
NewModel.add(NewSubject, NewProperty, NewObject);
Not sure what you are trying to do - a complete, minimal example would help.
*I am not sure whether these code can describe my opinion clearly :)*
*
*
*The last question is that ,when I list all the class of the OntModel
with the API listClasses() , It seems that the root class Thing have't
been listed.
Is it in the RDF?
No inference?
By the way: inference + TDB can be very slow and use a lot of RAM.
My aim is to create a RDFS file from the root class ,while
the Thing is the root class of all OWL file. If this API can't list out
the Thing class ,how could I create the Thing class as the root when
creating a new file,and then add all the other classes as its direct
subclasses or indirect subclasses.If it can't be achieved as what I want
, could you tell me why?*
*
*
*
*
*Best Regards, Thanks for your patient help very much again !!! *
*your,Lucas*
*
*
*
*
*
*