Skip to content

Commit

Permalink
Test passes for issue 292
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Apr 18, 2023
1 parent b85f537 commit a65e999
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 36 deletions.
5 changes: 5 additions & 0 deletions modules/srdf/src/main/scala/es/weso/rdf/RDFFormat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package es.weso.rdf

sealed abstract class RDFFormat {

}
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ object JenaMapper {
}

// I used org.apache.jena.vocabulary.RDF.dtRDFHTML but it seems to fail
lazy val rdfHTML =
new BaseDatatype("http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML")
lazy val rdfHTML = "http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML"

// I used org.apache.jena.vocabulary.RDF.dtRDFXMLLiteral but it seems to fail
lazy val rdfXML = new BaseDatatype("http://www.w3.org/1999/02/22-rdf-syntax-ns#XML")

// lazy val rdfXML = new BaseDatatype("http://www.w3.org/1999/02/22-rdf-syntax-ns#XML")
lazy val rdfXML = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XML"

def createRDFNode(m: JenaModel, node: RDFNode, base: Option[IRI]): JenaRDFNode = {
val xsd = "http://www.w3.org/2001/XMLSchema#"
val xsdinteger = xsd + "integer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import cats._
import cats.implicits._
import scala.jdk.CollectionConverters._
import org.apache.jena.datatypes.RDFDatatype
import org.apache.jena.datatypes.xsd.impl.RDFhtml
import org.apache.jena.datatypes.BaseDatatype
import java.io.InputStream
import java.io.ByteArrayInputStream

class JenaMapperTest extends CatsEffectSuite with JenaBased {

Expand Down Expand Up @@ -162,33 +166,5 @@ class JenaMapperTest extends CatsEffectSuite with JenaBased {
assertEquals(checkIsomorphic(model1, model2), ().asRight)
}

// Test added at issue: https://github.com/weso/srdf/issues/292
test("Should compare one triple with a rdf:HTML literal".only) {
val ts = Set(
RDFTriple(
IRI("http://example.org#a"),
IRI("http://example.org#p"),
RDFHTMLLiteral("<div>Test HTML markup</div>")))
val s =
"""|@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|<http://example.org#a> <http://example.org#p> "<div>Test HTML markup</div>"^^rdf:HTML .""".stripMargin
println(s"ts: $ts")
val empty = ModelFactory.createDefaultModel
val model1 = RDFTriples2Model(ts, empty, None)
val model2 = str2model(s)
val s1 = model1.listSubjects().toList().asScala.head
val s2 = model2.listSubjects().toList().asScala.head
println(s"Subject1 = $s1, ${s1.getClass().getName()}")
println(s"Subject2 = $s2, ${s2.getClass().getName()}")
println(s"Are equal? ${s1.equals(s2)}")

val o1dt = model1.listObjects().toList().asScala.head.asLiteral().getDatatype()
val o2dt = model2.listObjects().toList().asScala.head.asLiteral().getDatatype()
println(s"Object1 = $o1dt, ${o1dt.getClass().getName()}")
println(s"Object2 = $o2dt, ${o2dt.getClass().getName()}")
println(s"Are equal? ${o1dt.equals(o2dt)}")

assertEquals(checkIsomorphic(model1, model2), ().asRight)
}

}
2 changes: 1 addition & 1 deletion project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6")

2 changes: 1 addition & 1 deletion project/project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6")

2 changes: 1 addition & 1 deletion project/project/project/metals.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// This file enables sbt-bloop to create bloop config files.

addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.6")

2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "0.1.122"
ThisBuild / version := "0.1.123"

0 comments on commit a65e999

Please sign in to comment.