From 627b4707ea90c79c909edc055938804f3fd6db58 Mon Sep 17 00:00:00 2001 From: Jim Balhoff Date: Mon, 7 Aug 2023 12:45:49 -0400 Subject: [PATCH] Update to Jena 4.9.0. (#114) --- build.sbt | 2 +- src/main/scala/org/phenoscape/owlet/Owlet.scala | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 29d5438..63d4464 100644 --- a/build.sbt +++ b/build.sbt @@ -33,7 +33,7 @@ libraryDependencies ++= { Seq( "org.scalaz" %% "scalaz-core" % "7.3.7", "net.sourceforge.owlapi" % "owlapi-distribution" % "4.5.26", - "org.apache.jena" % "apache-jena-libs" % "4.1.0", + "org.apache.jena" % "apache-jena-libs" % "4.9.0", "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5", "org.scala-lang.modules" %% "scala-xml" % "2.0.1", "org.slf4j" % "slf4j-log4j12" % "1.7.32" % Test, diff --git a/src/main/scala/org/phenoscape/owlet/Owlet.scala b/src/main/scala/org/phenoscape/owlet/Owlet.scala index ba9acdc..e76c07e 100644 --- a/src/main/scala/org/phenoscape/owlet/Owlet.scala +++ b/src/main/scala/org/phenoscape/owlet/Owlet.scala @@ -1,7 +1,5 @@ package org.phenoscape.owlet -import java.util.UUID - import org.apache.jena.graph._ import org.apache.jena.graph.impl.GraphBase import org.apache.jena.query._ @@ -17,9 +15,9 @@ import org.semanticweb.owlapi.apibinding.OWLManager import org.semanticweb.owlapi.model._ import org.semanticweb.owlapi.reasoner.OWLReasoner +import java.util.UUID import scala.collection.JavaConverters._ import scala.collection.Map -import scala.collection.immutable.Set /** * Processes SPARQL queries containing triple patterns with embedded OWL class expressions. @@ -42,16 +40,16 @@ class Owlet(reasoner: OWLReasoner) { newQuery } - private class SPARQLVisitor(prefixes: Map[String, String], asValues: Boolean) extends RecursiveElementVisitor(new ElementVisitorBase()) { + private class SPARQLVisitor(prefixes: Map[String, String], asValues: Boolean) extends ElementVisitorBase { - override def endElement(filter: ElementFilter): Unit = filter.getExpr match { + override def visit(filter: ElementFilter): Unit = filter.getExpr match { case existsLike: ExprFunctionOp => existsLike.getElement.visit(this) case _ => () } - override def endElement(subquery: ElementSubQuery): Unit = subquery.getQuery.getQueryPattern.visit(this) + override def visit(subquery: ElementSubQuery): Unit = subquery.getQuery.getQueryPattern.visit(this) - override def endElement(group: ElementGroup): Unit = { + override def visit(group: ElementGroup): Unit = { for (pathBlock <- group.getElements.asScala.collect({ case pb: ElementPathBlock => pb })) { val patterns = pathBlock.getPattern.iterator while (patterns.hasNext) {