Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2cd7c0c7 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- improve Jena query evaluation

parent 607e9ddb
No related branches found
No related tags found
No related merge requests found
...@@ -446,11 +446,19 @@ public class MyApp { ...@@ -446,11 +446,19 @@ public class MyApp {
displayQueryAnswer( model, QueryFactory.create( transformedQuery ) ); displayQueryAnswer( model, QueryFactory.create( transformedQuery ) );
System.out.println( " ***** SPARQL Query answering in the merged ontology ***** " ); System.out.println( " ***** SPARQL Query answering in the merged ontology ***** " );
model = (OntModel)ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null ); // model = (OntModel)ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null );
model.read( "file:"+merged.getPath() ); //model.read( "file:"+merged.getPath() );
model.loadImports(); //model.loadImports();
/*
try { try {
merged = new File( "results/alignment.rdf" );
InputStream in = new FileInputStream( merged );
//OntModelSpec.OWL_MEM_RDFS_INF or no arguments to see the difference...
model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RDFS_INF,null);
model.read( in, "file:"+merged.getPath() );
in.close();
model.loadImports();
/*
// Not better // Not better
InputStream in = com.hp.hpl.jena.util.FileManager.get().open( merged.getPath() ); InputStream in = com.hp.hpl.jena.util.FileManager.get().open( merged.getPath() );
model = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null ); model = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null );
...@@ -467,7 +475,9 @@ public class MyApp { ...@@ -467,7 +475,9 @@ public class MyApp {
model = ModelFactory.createOntologyModel( s ); model = ModelFactory.createOntologyModel( s );
model.read( FileManager.get().open( merged.getPath() ), "file:"+merged.getPath() ); model.read( FileManager.get().open( merged.getPath() ), "file:"+merged.getPath() );
System.out.println( "NB Modles= "+model.countSubModels()+" ~~ "+model.hasLoadedImport( "http://alignapi.gforge.inria.fr/tutorial/tutorial4/ontology1.owl" )); System.out.println( "NB Modles= "+model.countSubModels()+" ~~ "+model.hasLoadedImport( "http://alignapi.gforge.inria.fr/tutorial/tutorial4/ontology1.owl" ));
in.close();
model.loadImports(); model.loadImports();
*/
OntClass cl = model.getOntClass( "http://alignapi.gforge.inria.fr/tutorial/tutorial4/ontology1.owl#Estudiante" ) ; OntClass cl = model.getOntClass( "http://alignapi.gforge.inria.fr/tutorial/tutorial4/ontology1.owl#Estudiante" ) ;
if ( cl != null ) { if ( cl != null ) {
...@@ -479,13 +489,11 @@ public class MyApp { ...@@ -479,13 +489,11 @@ public class MyApp {
} else { } else {
System.err.println( "Cannot find class" ); System.err.println( "Cannot find class" );
} }
in.close();
} catch (FileNotFoundException fnfe) { } catch (FileNotFoundException fnfe) {
fnfe.printStackTrace(); fnfe.printStackTrace();
} catch (IOException ioe) { } catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
} }
*/
displayQueryAnswer( model, QueryFactory.read( "file:query.sparql" ) ); displayQueryAnswer( model, QueryFactory.read( "file:query.sparql" ) );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment