1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
valider.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Model m=ModelFactory.createMemModelMaker().createModel(null);
FileManager.get().readModel( m, owlFile );
String myOntologyName = "ProjetHela";
String uri="file:///C:/Project/Krs1.owl";
// Définition de prefixe pour simplifier l'utilisation de SPARQL
String reuses = "maj: <"+RDF.getURI()+">" ;
// String myOntologyPrefix = "PREFIX "+myOntologyName+": <"+myOntologyNS+">" ;
String myOntologyPrefix = "PREFIX "+myOntologyName+": <"+uri+">" ;
// if (liste.getSelectedItem().toString().equals("GMP: Puissance=60352 Watt,limite supérieure= 73500 Watt")) {
String queryString=
"PREFIX maj: <http://www.owl-ontologies.com/reuses.owl#>"
+ "SELECT ?hasnameevaluated"
+ " WHERE "
+ "{"
+ "?Besoin maj:hasnameevaluated ?hasnameevaluated "
+"FILTER (?hasnameevaluated - 20) "
+ " } ";
Query query = QueryFactory.create(queryString) ;
QueryExecution qexec = QueryExecutionFactory.create(query, m) ;
try {
ResultSet rs = qexec.execSelect() ;
// Affichage des resultats
for ( ; rs.hasNext() ; ){
//System.out.print("");
QuerySolution rb = rs.nextSolution() ;
String y = rb.getLiteral("hasnameevaluated").getString();
System.out.println( " " + y);
}} finally {
qexec.close() ;
}
}
}
); |
Partager