diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxAnswerTuples.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxAnswerTuples.java | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxAnswerTuples.java b/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxAnswerTuples.java deleted file mode 100644 index f823232..0000000 --- a/src/uk/ac/ox/cs/pagoda/reasoner/light/RDFoxAnswerTuples.java +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.reasoner.light; | ||
| 2 | |||
| 3 | import org.semanticweb.HermiT.model.Constant; | ||
| 4 | import org.semanticweb.HermiT.model.Individual; | ||
| 5 | import org.semanticweb.HermiT.model.Term; | ||
| 6 | import uk.ac.ox.cs.JRDFox.JRDFStoreException; | ||
| 7 | import uk.ac.ox.cs.JRDFox.model.GroundTerm; | ||
| 8 | import uk.ac.ox.cs.JRDFox.store.TupleIterator; | ||
| 9 | import uk.ac.ox.cs.pagoda.query.AnswerTuple; | ||
| 10 | import uk.ac.ox.cs.pagoda.query.AnswerTuples; | ||
| 11 | import uk.ac.ox.cs.pagoda.util.Utility; | ||
| 12 | import uk.ac.ox.cs.pagoda.util.disposable.DisposedException; | ||
| 13 | |||
| 14 | public class RDFoxAnswerTuples extends AnswerTuples { | ||
| 15 | |||
| 16 | long multi; | ||
| 17 | TupleIterator m_iter; | ||
| 18 | String[] m_answerVars; | ||
| 19 | |||
| 20 | public RDFoxAnswerTuples(String[] answerVars, TupleIterator iter) { | ||
| 21 | m_answerVars = answerVars; | ||
| 22 | m_iter = iter; | ||
| 23 | reset(); | ||
| 24 | } | ||
| 25 | |||
| 26 | public static Term getHermitTerm(GroundTerm t) { | ||
| 27 | if(t instanceof uk.ac.ox.cs.JRDFox.model.Individual) { | ||
| 28 | uk.ac.ox.cs.JRDFox.model.Individual individual = (uk.ac.ox.cs.JRDFox.model.Individual) t; | ||
| 29 | return Individual.create(individual.getIRI()); | ||
| 30 | } | ||
| 31 | else { | ||
| 32 | uk.ac.ox.cs.JRDFox.model.Literal literal = ((uk.ac.ox.cs.JRDFox.model.Literal) t); | ||
| 33 | return Constant.create(literal.getLexicalForm(), literal.getDatatype().getIRI()); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | @Override | ||
| 38 | public boolean isValid() { | ||
| 39 | if(isDisposed()) throw new DisposedException(); | ||
| 40 | |||
| 41 | return multi != 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | @Override | ||
| 45 | public int getArity() { | ||
| 46 | if(isDisposed()) throw new DisposedException(); | ||
| 47 | |||
| 48 | try { | ||
| 49 | return m_iter.getArity(); | ||
| 50 | } catch (JRDFStoreException e) { | ||
| 51 | e.printStackTrace(); | ||
| 52 | return -1; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | @Override | ||
| 57 | public void moveNext() { | ||
| 58 | if(isDisposed()) throw new DisposedException(); | ||
| 59 | |||
| 60 | try { | ||
| 61 | multi = m_iter.getNext(); | ||
| 62 | } catch (JRDFStoreException e) { | ||
| 63 | e.printStackTrace(); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | @Override | ||
| 68 | public void dispose() { | ||
| 69 | super.dispose(); | ||
| 70 | m_iter.dispose(); | ||
| 71 | } | ||
| 72 | |||
| 73 | @Override | ||
| 74 | public AnswerTuple getTuple() { | ||
| 75 | if(isDisposed()) throw new DisposedException(); | ||
| 76 | |||
| 77 | return new AnswerTuple(m_iter, m_answerVars.length); | ||
| 78 | } | ||
| 79 | |||
| 80 | @Override | ||
| 81 | public void reset() { | ||
| 82 | if(isDisposed()) throw new DisposedException(); | ||
| 83 | |||
| 84 | try { | ||
| 85 | multi = m_iter.open(); | ||
| 86 | } catch (JRDFStoreException e) { | ||
| 87 | e.printStackTrace(); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | |||
| 91 | @Override | ||
| 92 | public boolean contains(AnswerTuple t) { | ||
| 93 | if(isDisposed()) throw new DisposedException(); | ||
| 94 | |||
| 95 | Utility.logError("Unsupported operation in RDFoxAnswerTuples"); | ||
| 96 | return false; | ||
| 97 | } | ||
| 98 | |||
| 99 | @Override | ||
| 100 | public void remove() { | ||
| 101 | if(isDisposed()) throw new DisposedException(); | ||
| 102 | |||
| 103 | Utility.logError("Unsupported operation in RDFoxAnswerTuples"); | ||
| 104 | } | ||
| 105 | |||
| 106 | @Override | ||
| 107 | public String[] getAnswerVariables() { | ||
| 108 | if(isDisposed()) throw new DisposedException(); | ||
| 109 | |||
| 110 | return m_answerVars; | ||
| 111 | } | ||
| 112 | |||
| 113 | protected void finalize() { | ||
| 114 | m_iter.dispose(); | ||
| 115 | } | ||
| 116 | |||
| 117 | } | ||
