Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-owl] Sparql Query

侯滇滇 hoho8419 at 163.com
Mon Mar 30 01:07:06 PDT 2009


import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import javax.swing.text.html.HTMLDocument.Iterator; import edu.stanford.smi.protege.model.Project; import edu.stanford.smi.protege.model.query.Query; import edu.stanford.smi.protegex.owl.ProtegeOWL; import edu.stanford.smi.protegex.owl.database.OWLDatabaseKnowledgeBaseFactory; import edu.stanford.smi.protegex.owl.database.OWLDatabaseModel; import edu.stanford.smi.protegex.owl.jena.Jena; import edu.stanford.smi.protegex.owl.jena.JenaOWLModel; import edu.stanford.smi.protegex.owl.model.OWLDatatypeProperty; import edu.stanford.smi.protegex.owl.model.OWLIndividual; import edu.stanford.smi.protegex.owl.model.OWLModel; import edu.stanford.smi.protegex.owl.model.OWLNamedClass; import edu.stanford.smi.protegex.owl.model.OWLObjectProperty; import edu.stanford.smi.protegex.owl.model.RDFResource; import edu.stanford.smi.protegex.owl.model.query.QueryResults; public class QueryFilterTest { public static void main(String[] args) { try{ JenaOWLModel owlModel = ProtegeOWL.createJenaOWLModel(); owlModel.getNamespaceManager().setDefaultNamespace("http://hello.com#"); // OWLNamedClass worldClass = owlModel.createOWLNamedClass("World"); OWLNamedClass personClass = owlModel.createOWLNamedClass("Person"); OWLNamedClass brotherClass = owlModel.createOWLNamedClass("Brother"); brotherClass.addSuperclass(personClass); brotherClass.removeSuperclass(owlModel.getOWLThingClass()); OWLDatatypeProperty hasName=owlModel.createOWLDatatypeProperty("hasName"); hasName.setRange(owlModel.getXSDstring()); OWLObjectProperty hasBrother=owlModel.createOWLObjectProperty("hasBrother"); OWLNamedClass sisterClass = owlModel.createOWLNamedSubclass("Sister", personClass); OWLIndividual hans = brotherClass.createOWLIndividual("Hans"); OWLIndividual tom = brotherClass.createOWLIndividual("Tom"); OWLIndividual hans1 = brotherClass.createOWLIndividual("Hans1"); OWLIndividual tom1 = brotherClass.createOWLIndividual("Tom1"); //hans.setPropertyValue(hasName, "你好"); hans.setPropertyValue(hasName, "张,网"); tom.setPropertyValue(hasName, "张,网,四"); hans1.setPropertyValue(hasName, "张,网,三"); tom1.setPropertyValue(hasName, "张,三"); hans.setPropertyValue(hasBrother, tom); hans.addPropertyValue(hasBrother, tom1); hans.addPropertyValue(hasBrother, hans1); tom.setPropertyValue(hasBrother, tom); tom.addPropertyValue(hasBrother, hans1); // Jena.dumpRDF(owlModel.getOntModel()); // System.out.println(hans.getPropertyValue(hasBrother)); //查询语句 String sparql="PREFIX hello: 


在2009-03-30,"侯滇滇" <hoho8419 at 163.com> 写道:
String sqarql="PREFIX rdfs 

在2009-03-30,"Amrapali Zaveri" <amrapali.zaveri at gmail.com> 写道:
Hi,

Please can you tell me a simple query where I can retrieve the only 2 instances of a class named Trial which is a sub-class of owl:Thing.

Thanks,
Regards
Amrapali




网易邮箱,中国第一大电子邮件服务商
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-owl/attachments/20090330/ace73992/attachment.html>


More information about the protege-owl mailing list