Skip to content

Commit c44a2e1

Browse files
authored
Update to ZIO 2 release version. (#139)
1 parent 4e6bd24 commit c44a2e1

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
lazy val zioVersion = "2.0.0-RC5"
1+
lazy val zioVersion = "2.0.0"
22
lazy val gitCommitString = SettingKey[String]("gitCommit")
33

44
lazy val commonSettings = Seq(

core/src/main/scala/org/renci/relationgraph/RelationGraph.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ object RelationGraph extends StrictLogging {
6464
.when(outputConfig.mode == OWLMode)
6565
val classesTasks = if (outputConfig.outputSubclasses) {
6666
allClasses(ontology).map(c => ZIO.succeed(processSubclasses(c, indexedWhelk.state, outputConfig.reflexiveSubclasses, outputConfig.equivalenceAsSubclass, outputConfig.outputClasses, outputConfig.outputIndividuals)))
67-
} else Stream.empty
67+
} else ZStream.empty
6868
val streamZ = for {
6969
queue <- Queue.unbounded[Restriction]
7070
activeRestrictions <- Ref.make(0)
7171
seenRefs <- ZIO.foreach(allProperties)(p => Ref.make(Set.empty[AtomicConcept]).map(p -> _)).map(_.toMap)
7272
_ <- traverse(specifiedProperties, properties, classes, queue, activeRestrictions, seenRefs)
73-
restrictionsStream = Stream.fromQueue(queue).map(r => processRestrictionAndExtendQueue(r, properties, classes, indexedWhelk, outputConfig.mode, specifiedProperties.isEmpty, outputConfig.outputClasses, outputConfig.outputIndividuals, queue, activeRestrictions, seenRefs))
73+
restrictionsStream = ZStream.fromQueue(queue).map(r => processRestrictionAndExtendQueue(r, properties, classes, indexedWhelk, outputConfig.mode, specifiedProperties.isEmpty, outputConfig.outputClasses, outputConfig.outputIndividuals, queue, activeRestrictions, seenRefs))
7474
allTasks = ontologyDeclarationStream ++ classesTasks ++ restrictionsStream
7575
} yield allTasks.mapZIOParUnordered(JRuntime.getRuntime.availableProcessors)(identity)
76-
Stream.unwrap(streamZ)
76+
ZStream.unwrap(streamZ)
7777
}
7878

79-
def allClasses(ont: OWLOntology): ZStream[Any, Nothing, OWLClass] = Stream.fromIterable(ont.getClassesInSignature(Imports.INCLUDED).asScala.to(Set) - OWLThing - OWLNothing)
79+
def allClasses(ont: OWLOntology): ZStream[Any, Nothing, OWLClass] = ZStream.fromIterable(ont.getClassesInSignature(Imports.INCLUDED).asScala.to(Set) - OWLThing - OWLNothing)
8080

8181
def traverse(specifiedProperties: Set[AtomicConcept], properties: Hierarchy, classes: Hierarchy, queue: Queue[Restriction], activeRestrictions: Ref[Int], seenRefs: Map[Role, Ref[Set[AtomicConcept]]]): UIO[Unit] = {
8282
val descendProperties = specifiedProperties.isEmpty

core/src/main/scala/org/renci/relationgraph/RelationGraphUtil.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object RelationGraphUtil {
2222
/**
2323
* @param ontology
2424
* @param specifiedProperties properties for which to compute relations; an empty collection signifies all
25-
* @param outputConfig configuration for RelationGraph; `mode` is ignored, since results are converted to OWL axioms
25+
* @param outputConfig configuration for RelationGraph; `mode` is ignored, since results are converted to OWL axioms
2626
* @return
2727
*/
2828
def computeRelationGraph(ontology: OWLOntology, specifiedProperties: util.Collection[IRI], outputConfig: Config): util.Set[OWLClassAxiom] = {
@@ -41,7 +41,9 @@ object RelationGraphUtil {
4141
.runCollect
4242
.map(_.toSet.flatten[OWLClassAxiom])
4343
.map(_.asJava)
44-
Runtime.default.unsafeRun(owlZ)
44+
Unsafe.unsafe { implicit u =>
45+
Runtime.default.unsafe.run(owlZ).getOrThrow()
46+
}
4547
}
4648

4749
}

0 commit comments

Comments
 (0)