From 17bd9beaf7f358a44e5bf36a5855fe6727d506dc Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Tue, 10 May 2022 18:17:06 +0100 Subject: [pagoda] Move project to Scala This commit includes a few changes: - The repository still uses Maven to manage dependency but it is now a Scala project. - The code has been ported from OWLAPI 3.4.10 to 5.1.20 - A proof of concept program using both RSAComb and PAGOdA has been added. --- test/uk/ac/ox/cs/jrdfox/Tester.java | 195 ------------------------------------ 1 file changed, 195 deletions(-) delete mode 100644 test/uk/ac/ox/cs/jrdfox/Tester.java (limited to 'test/uk/ac/ox/cs/jrdfox/Tester.java') diff --git a/test/uk/ac/ox/cs/jrdfox/Tester.java b/test/uk/ac/ox/cs/jrdfox/Tester.java deleted file mode 100644 index 94f5401..0000000 --- a/test/uk/ac/ox/cs/jrdfox/Tester.java +++ /dev/null @@ -1,195 +0,0 @@ -package uk.ac.ox.cs.jrdfox; - -import java.io.File; - -import org.semanticweb.owlapi.model.OWLOntology; - -import uk.ac.ox.cs.JRDFox.JRDFStoreException; -import uk.ac.ox.cs.JRDFox.Prefixes; -import uk.ac.ox.cs.JRDFox.store.DataStore; -import uk.ac.ox.cs.JRDFox.store.DataStore.UpdateType; -import uk.ac.ox.cs.JRDFox.store.Parameters; -import uk.ac.ox.cs.JRDFox.store.TripleStatus; -import uk.ac.ox.cs.JRDFox.store.TupleIterator; -import uk.ac.ox.cs.JRDFox.store.DataStore.StoreType; -import uk.ac.ox.cs.pagoda.owl.OWLHelper; -import uk.ac.ox.cs.pagoda.reasoner.light.RDFoxQueryEngine; -import uk.ac.ox.cs.pagoda.util.Namespace; -import uk.ac.ox.cs.pagoda.util.Timer; - -public class Tester { - - public static void main(String[] args) throws JRDFStoreException { - Tester tester = new Tester(); - tester.testCrash(); - } - - private void evaluate_againstIDs(String queryText) throws JRDFStoreException { - int number = 0; - Timer t = new Timer(); - TupleIterator iter = null; - try { - iter = store.compileQuery(queryText, prefixes, parameters, TripleStatus.TUPLE_STATUS_IDB.union(TripleStatus.TUPLE_STATUS_EDB), TripleStatus.TUPLE_STATUS_IDB); - for (long multi = iter.open(); multi != 0; multi = iter.getNext()) - ++number; - } finally { - if (iter != null) iter.dispose(); - } - System.out.println(number); - System.out.println(t.duration()); - - } - - DataStore store; - Prefixes prefixes = new Prefixes(); - Parameters parameters; - - public Tester() { - try { - store = new DataStore(StoreType.NarrowParallelHead); - store.setNumberOfThreads(RDFoxQueryEngine.matNoOfThreads); - store.initialize(); - System.out.println("data store created."); - } catch (JRDFStoreException e) { - e.printStackTrace(); - } - parameters = new Parameters(); - parameters.m_allAnswersInRoot = true; - parameters.m_useBushy = true; - } - - public Tester(String path) { - try { - store = new DataStore(new File(path)); - } catch (JRDFStoreException e) { - e.printStackTrace(); - } - parameters = new Parameters(); -// parameters.m_allAnswersInRoot = true; -// parameters.m_useBushy = true; - } - - public void applyReasoning(boolean incremental) { - Timer t = new Timer(); - try { - store.applyReasoning(incremental); - } catch (JRDFStoreException e) { - e.printStackTrace(); - } - System.out.println("reasoning done: " + t.duration()); - } - - public void dispose() { - store.dispose(); - } - - public void testCrash() throws JRDFStoreException { -// DataStore lowerStore = new DataStore(StoreType.NarrowParallelHead); -// lowerStore.setNumberOfThreads(RDFoxQueryEngine.matNoOfThreads); -// lowerStore.initialize(); -// System.out.println("lower data store created."); - OWLOntology ontology = OWLHelper.loadOntology("data/fly/fly_anatomy_XP_with_GJ_FC_individuals.owl"); - System.out.println("ontology loaded ... " + ontology.getAxiomCount()); - - store.importTurtleFile(new File("testcase/fly.ttl")); - System.out.println("data loaded. " + store.getTriplesCount()); - - store.importRules(new File[] {new File("testcase/lower.dlog")}); - System.out.println("rules loaded. " + store.getTriplesCount()); - - store.applyReasoning(); - System.out.println("materialised. " + store.getTriplesCount()); - - store.clearRulesAndMakeFactsExplicit(); - - store.importRules(new File[] {new File("testcase/multi.dlog")}); - System.out.println("rules loaded. " + store.getTriplesCount()); - - store.applyReasoning(); - System.out.println("materialised. " + store.getTriplesCount()); - - store.makeFactsExplicit(); - - store.importTurtleFiles(new File[] {new File("testcase/first.ttl")}, UpdateType.ScheduleForAddition); - System.out.println("first data loaded. " + store.getTriplesCount()); - - store.applyReasoning(true); - System.out.println("incremental reasoning done. " + store.getTriplesCount()); - - store.clearRulesAndMakeFactsExplicit(); - - store.importTurtleFiles(new File[] {new File("testcase/second.ttl")}, UpdateType.ScheduleForAddition); - store.importRules(new File[] {new File("testcase/tracking.dlog")}, UpdateType.ScheduleForAddition); - store.applyReasoning(true); - System.out.println("incremental reasoning done. " + store.getTriplesCount()); - - evaluate_againstIDs("select distinct ?z where { ?x <" + Namespace.RDF_TYPE + "> ?z . }"); - System.out.println("done."); -// tester.applyReasoning(true); -// tester.evaluate_againstIDs("select distinct ?z where { ?x <" + Namespace.RDF_TYPE + "> ?z . }"); -// System.out.println("done."); - - store.dispose(); -// lowerStore.dispose(); - } - - public void test() throws JRDFStoreException { - evaluate("PREFIX benchmark: " - + "SELECT distinct ?x WHERE { " - + "?x a benchmark:Person . " - + "?x benchmark:like ?y . " - + "?z a benchmark:Chair . " - + "?z benchmark:isHeadOf . " - + "?z benchmark:like ?y . " - + "?x a . " - + "?z a . " - + "?y a }"); - - evaluate("PREFIX benchmark: " - + "SELECT distinct ?x WHERE { " - + "?x a benchmark:Person . " - + "?x benchmark:like ?y . " - + "?z a benchmark:Chair . " - + "?z benchmark:isHeadOf . " - + "?z benchmark:like ?y . " - + "?z a . " - + "?y a ." - + "?x a }"); - - evaluate("PREFIX benchmark: " - + "SELECT distinct ?x WHERE { " - + "?x a benchmark:Person . " - + "?x benchmark:like ?y . " - + "?z a benchmark:Chair . " - + "?z benchmark:isHeadOf . " - + "?z benchmark:like ?y . " - + "?y a . " - + "?x a . " - + "?z a }"); - - evaluate("PREFIX benchmark: " - + "SELECT distinct ?x WHERE { " - + "?x a benchmark:Person . " - + "?x benchmark:like ?y . " - + "?z a benchmark:Chair . " - + "?z benchmark:isHeadOf . " - + "?z benchmark:like ?y . " - + "?y a }"); - } - - public void evaluate(String query) throws JRDFStoreException { - int number = 0; - Timer t = new Timer(); - TupleIterator iter = null; - try { - iter = store.compileQuery(query, prefixes, parameters); - for (long multi = iter.open(); multi != 0; multi = iter.getNext()) - ++number; - } finally { - if (iter != null) iter.dispose(); - } - System.out.println(number); - System.out.println(t.duration()); - } - -} -- cgit v1.2.3