<commit_before>package it.unibz.krdb.obda.owlrefplatform.owlapi3;

import it.unibz.krdb.obda.model.GraphResultSet;
import it.unibz.krdb.obda.model.OBDAException;
import it.unibz.krdb.obda.model.Predicate;
import it.unibz.krdb.obda.ontology.Assertion;
import it.unibz.krdb.obda.ontology.ClassAssertion;
import it.unibz.krdb.obda.ontology.DataPropertyAssertion;
import it.unibz.krdb.obda.ontology.Description;
import it.unibz.krdb.obda.ontology.ObjectPropertyAssertion;
import it.unibz.krdb.obda.owlapi3.OWLAPI3ABoxIterator;
import it.unibz.krdb.obda.owlapi3.OWLConnection;
import it.unibz.krdb.obda.owlapi3.OWLResultSet;
import it.unibz.krdb.obda.owlapi3.OWLStatement;
import it.unibz.krdb.obda.owlrefplatform.core.QuestStatement;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLDataProperty;
import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLException;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.util.OWLOntologyMerger;

public class QuestOWLStatement implements OWLStatement {

	private QuestStatement st;
	private QuestOWLConnection conn;

	public QuestOWLStatement(QuestStatement st, QuestOWLConnection conn) {
		this.conn = conn;
		this.st = st;
	}
	
	
	
	public QuestStatement getQuestStatement() {
		return st;
	}

	@Override
	public void cancel() throws OWLException {
		try {
			st.cancel();
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}

	@Override
	public void close() throws OWLException {
		try {
			st.close();
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}

	@Override
	public OWLResultSet execute(String query) throws OWLException {
		try {
			return new QuestOWLResultSet(st.execute(query), this);
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}

	@Override
	public List<OWLAxiom> executeConstruct(String query) throws OWLException {
		try {
			GraphResultSet resultSet = st.executeConstruct(query);
			return createOWLIndividualAxioms(resultSet);
		} catch (Exception e) {
			throw new OWLOntologyCreationException(e);
		}
	}

	@Override
	public List<OWLAxiom> executeDescribe(String query) throws OWLException {
		try {
			GraphResultSet resultSet = st.executeDescribe(query);<commit_msg>* Missed call to create indexes and SemanticIndexLUBMH2 was too slow<commit_after>package it.unibz.krdb.obda.owlrefplatform.owlapi3;

import it.unibz.krdb.obda.model.GraphResultSet;
import it.unibz.krdb.obda.model.OBDAException;
import it.unibz.krdb.obda.model.Predicate;
import it.unibz.krdb.obda.ontology.Assertion;
import it.unibz.krdb.obda.ontology.ClassAssertion;
import it.unibz.krdb.obda.ontology.DataPropertyAssertion;
import it.unibz.krdb.obda.ontology.Description;
import it.unibz.krdb.obda.ontology.ObjectPropertyAssertion;
import it.unibz.krdb.obda.owlapi3.OWLAPI3ABoxIterator;
import it.unibz.krdb.obda.owlapi3.OWLConnection;
import it.unibz.krdb.obda.owlapi3.OWLResultSet;
import it.unibz.krdb.obda.owlapi3.OWLStatement;
import it.unibz.krdb.obda.owlrefplatform.core.QuestStatement;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassAssertionAxiom;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLDataProperty;
import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLException;
import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.util.OWLOntologyMerger;

public class QuestOWLStatement implements OWLStatement {

	private QuestStatement st;
	private QuestOWLConnection conn;

	public QuestOWLStatement(QuestStatement st, QuestOWLConnection conn) {
		this.conn = conn;
		this.st = st;
	}
	
	
	
	public QuestStatement getQuestStatement() {
		return st;
	}

	@Override
	public void cancel() throws OWLException {
		try {
			st.cancel();
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}

	@Override
	public void close() throws OWLException {
		try {
			st.close();
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}

	@Override
	public OWLResultSet execute(String query) throws OWLException {
		try {
			return new QuestOWLResultSet(st.execute(query), this);
		} catch (OBDAException e) {
			OWLException owlException = new OWLException(e) {
			};
			owlException.setStackTrace(e.getStackTrace());
			throw owlException;
		}
	}
	
	public void createIndexes() throws Exception {
		st.createIndexes();
	}
	
	public void dropIndexes() throws Exception {
		st.dropIndexes();

	}

	@Override
	public List<OWLAxiom> executeConstruct(String query) throws OWLException {
		try {
			GraphResultSet resultSet = st.executeConstruct(query);
			return createOWLIndividualAxioms(resultSet);
		} catch (Exception e) {
			throw new OWLOntologyCreationException(e);
		}
	}

	@Override
	public List<OWLAxiom> executeDescribe(String query) throws OWLException {
		try {
			GraphResultSet resultSet = st.executeDescribe(query);
{'fraction_non_alphanumeric': 0.09982461268634903, 'fraction_numerical': 0.001900029231218942, 'mean_word_length': 5.371508379888268, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2021407', 'n_tokens_mistral': 2585, 'n_tokens_neox': 2383, 'n_words': 391}