diff options
| author | Federico Igne <git@federicoigne.com> | 2021-10-03 10:21:10 +0100 |
|---|---|---|
| committer | Federico Igne <git@federicoigne.com> | 2021-10-03 10:22:03 +0100 |
| commit | 44b8e1c8c724bf7f62f2b567548b941f88a31dc6 (patch) | |
| tree | c0e0d39a7dd4327f762b573d1fcaf13d8473584b /src/main/scala | |
| parent | d0868f102ac29a04461d9aa68230c0d4bb663426 (diff) | |
| download | RSAComb-44b8e1c8c724bf7f62f2b567548b941f88a31dc6.tar.gz RSAComb-44b8e1c8c724bf7f62f2b567548b941f88a31dc6.zip | |
Fix compilation errors
Diffstat (limited to 'src/main/scala')
4 files changed, 27 insertions, 23 deletions
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala index 21e0506..275f523 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/RSAOntology.scala | |||
| @@ -114,9 +114,8 @@ object RSAOntology { | |||
| 114 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = | 114 | def filteringProgram(query: ConjunctiveQuery): FilteringProgram = |
| 115 | Logger.timed( | 115 | Logger.timed( |
| 116 | { | 116 | { |
| 117 | val filter = | 117 | val filter = FilteringProgram(FilterType.REVISED) |
| 118 | FilteringProgram(FilterType.REVISED, CanonGraph, FilterGraph(query)) | 118 | filter(CanonGraph, FilterGraph(query), query) |
| 119 | filter(query) | ||
| 120 | }, | 119 | }, |
| 121 | "Generating filtering program", | 120 | "Generating filtering program", |
| 122 | Logger.DEBUG | 121 | Logger.DEBUG |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/filtering/FilteringProgram.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/filtering/FilteringProgram.scala index 3015def..075954e 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/filtering/FilteringProgram.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/filtering/FilteringProgram.scala | |||
| @@ -36,7 +36,7 @@ object FilteringProgram extends Versioned[FilterType] { | |||
| 36 | 36 | ||
| 37 | import FilterType._ | 37 | import FilterType._ |
| 38 | 38 | ||
| 39 | type Result = (ConjunctiveQuery) => FilteringProgram | 39 | type Result = (IRI, IRI, ConjunctiveQuery) => FilteringProgram |
| 40 | 40 | ||
| 41 | /** Returns the right type of filtering program builder. | 41 | /** Returns the right type of filtering program builder. |
| 42 | * | 42 | * |
| @@ -46,14 +46,10 @@ object FilteringProgram extends Versioned[FilterType] { | |||
| 46 | * | 46 | * |
| 47 | * @return the right type of filtering program builder. | 47 | * @return the right type of filtering program builder. |
| 48 | */ | 48 | */ |
| 49 | def apply( | 49 | def apply(filter: FilterType): Result = |
| 50 | filter: FilterType, | ||
| 51 | source: IRI, | ||
| 52 | target: IRI | ||
| 53 | ): (ConjunctiveQuery) => FilteringProgram = | ||
| 54 | filter match { | 50 | filter match { |
| 55 | case NAIVE => NaiveFilteringProgram(source, target, _) | 51 | case NAIVE => NaiveFilteringProgram(_, _, _) |
| 56 | case REVISED => RevisedFilteringProgram(source, target, _) | 52 | case REVISED => RevisedFilteringProgram(_, _, _) |
| 57 | } | 53 | } |
| 58 | } | 54 | } |
| 59 | 55 | ||
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala index 1f44ce1..8d46646 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/ontology/Ontology.scala | |||
| @@ -29,8 +29,13 @@ import org.semanticweb.owlapi.apibinding.OWLManager | |||
| 29 | import org.semanticweb.owlapi.model.{OWLOntology, OWLAxiom, OWLLogicalAxiom} | 29 | import org.semanticweb.owlapi.model.{OWLOntology, OWLAxiom, OWLLogicalAxiom} |
| 30 | import org.semanticweb.owlapi.model.{OWLObjectPropertyExpression} | 30 | import org.semanticweb.owlapi.model.{OWLObjectPropertyExpression} |
| 31 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory | 31 | import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory |
| 32 | import tech.oxfordsemantic.jrdfox.logic.datalog.Rule | 32 | import tech.oxfordsemantic.jrdfox.logic.datalog.{Rule, TupleTableName} |
| 33 | import tech.oxfordsemantic.jrdfox.logic.expression.{Resource, Term, Variable} | 33 | import tech.oxfordsemantic.jrdfox.logic.expression.{ |
| 34 | IRI, | ||
| 35 | Resource, | ||
| 36 | Term, | ||
| 37 | Variable | ||
| 38 | } | ||
| 34 | 39 | ||
| 35 | import uk.ac.ox.cs.rsacomb.approximation.Approximation | 40 | import uk.ac.ox.cs.rsacomb.approximation.Approximation |
| 36 | import uk.ac.ox.cs.rsacomb.converter._ | 41 | import uk.ac.ox.cs.rsacomb.converter._ |
| @@ -143,10 +148,11 @@ object Ontology { | |||
| 143 | RSA.U(varY) | 148 | RSA.U(varY) |
| 144 | ) :: rules | 149 | ) :: rules |
| 145 | /* Load facts and rules from ontology */ | 150 | /* Load facts and rules from ontology */ |
| 146 | RDFoxUtil.addFacts(data, facts) | 151 | val ttn = IRI.create(TupleTableName.DEFAULT_TRIPLES.getName) |
| 152 | RDFoxUtil.addFacts(data, ttn, facts) | ||
| 147 | RDFoxUtil.addRules(data, rules) | 153 | RDFoxUtil.addRules(data, rules) |
| 148 | /* Load data files */ | 154 | /* Load data files */ |
| 149 | RDFoxUtil.addData(data, datafiles: _*) | 155 | RDFoxUtil.addData(data, ttn, datafiles: _*) |
| 150 | 156 | ||
| 151 | /* Build the graph */ | 157 | /* Build the graph */ |
| 152 | val query = "SELECT ?X ?Y WHERE { ?X rsa:E ?Y }" | 158 | val query = "SELECT ?X ?Y WHERE { ?X rsa:E ?Y }" |
diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala index 73da80f..105f425 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/sparql/ConjunctiveQuery.scala | |||
| @@ -100,12 +100,12 @@ class ConjunctiveQuery( | |||
| 100 | 100 | ||
| 101 | /** Returns the query body as a sequence of atoms (triples). */ | 101 | /** Returns the query body as a sequence of atoms (triples). */ |
| 102 | def atoms(graph: TupleTableName): List[TupleTableAtom] = | 102 | def atoms(graph: TupleTableName): List[TupleTableAtom] = |
| 103 | where.collect { case c: ConjunctionPattern => | 103 | where |
| 104 | c.getConjuncts.collect { case t: TriplePattern => | 104 | .asInstanceOf[ConjunctionPattern] |
| 105 | TupleTableAtom | 105 | .getConjuncts |
| 106 | .create(graph, t.getSubject, t.getPredicate, t.getObject) | 106 | .collect { case t: TriplePattern => |
| 107 | TupleTableAtom.create(graph, t.getSubject, t.getPredicate, t.getObject) | ||
| 107 | } | 108 | } |
| 108 | }.flatten | ||
| 109 | // where match { | 109 | // where match { |
| 110 | // case b: ConjunctionPattern => { | 110 | // case b: ConjunctionPattern => { |
| 111 | // b.getConjuncts.toList.flatMap { conj: QueryPattern => | 111 | // b.getConjuncts.toList.flatMap { conj: QueryPattern => |
| @@ -123,13 +123,16 @@ class ConjunctiveQuery( | |||
| 123 | 123 | ||
| 124 | /** Returns the full collection of variables involved in the query. */ | 124 | /** Returns the full collection of variables involved in the query. */ |
| 125 | val variables: List[Variable] = | 125 | val variables: List[Variable] = |
| 126 | where.collect { case c: ConjunctionPattern => | 126 | where |
| 127 | c.getConjuncts.collect { case t: TriplePattern => | 127 | .asInstanceOf[ConjunctionPattern] |
| 128 | .getConjuncts | ||
| 129 | .collect { case t: TriplePattern => | ||
| 128 | Set(t.getSubject, t.getPredicate, t.getObject).collect { | 130 | Set(t.getSubject, t.getPredicate, t.getObject).collect { |
| 129 | case v: Variable => v | 131 | case v: Variable => v |
| 130 | } | 132 | } |
| 131 | } | 133 | } |
| 132 | }.distinct | 134 | .flatten |
| 135 | .distinct | ||
| 133 | // (where match { | 136 | // (where match { |
| 134 | // case b: ConjunctionPattern => { | 137 | // case b: ConjunctionPattern => { |
| 135 | // b.getConjuncts.toList.flatMap { conj: QueryPattern => | 138 | // b.getConjuncts.toList.flatMap { conj: QueryPattern => |
