Skip to content

Commit

Permalink
fix for thygraph exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazzpirate committed May 3, 2024
1 parent 7731159 commit 92ef583
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ abstract class RelationGraphExporter extends StructurePresenter {
val svg = try {
dot(dg)
} catch {
case e: Exception => throw LocalError("error while producing graph").setCausedBy(e)
case e: Exception =>
throw LocalError("error while producing graph").setCausedBy(e)
}
rh(svg)
}
Expand Down
20 changes: 18 additions & 2 deletions src/mmt-api/src/main/info/kwarc/mmt/api/ontology/ULO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,22 @@ trait RDFRelStoreLike extends RelStoreLike { this : RDFStore =>

def query(start: Path, q: RelationExp)(implicit add: Path => Unit) = {
val qv = SparqlBuilder.`var`("qv")
val p = makeQuery(q)
val query = Queries.SELECT(qv).where(GraphPatterns.tp(qv, p, pathToIri(start)))
val (nq,tps) = q match {
case Sequence(qs @ _*) =>
val tps = qs.collect {
case q@HasType(_, Nil) => q
case HasType(_,_) =>
println("HERE!")
???
}
val nq = qs.filterNot(tps.contains)
val ntps = tps.flatMap(_.mustHave).flatten
if (nq.length == 1) (nq.head,ntps.toList)
else (Choice(nq:_*),ntps.toList)
case _ => (q,Nil)
}
val p = makeQuery(nq)
val query = Queries.SELECT(qv).where(GraphPatterns.tp(qv, p, pathToIri(start)) :: tps.map(tp => GraphPatterns.tp(qv, RDF.TYPE, tp.toULO.toIri)) :_*)
import scala.jdk.CollectionConverters._
repo.getConnection.prepareTupleQuery(query.getQueryString).evaluate().forEach { res =>
val vl = res.getBinding("qv").getValue
Expand All @@ -923,6 +937,8 @@ trait RDFRelStoreLike extends RelStoreLike { this : RDFStore =>
() => "(" + qs.map(makeQuery(_).getQueryString).mkString("|") + ")"
case Transitive(q) =>
() => "(" + makeQuery(q).getQueryString + ")+"
case Sequence(qs@_*) =>
() => qs.map(makeQuery(_).getQueryString).mkString(", ")
case _ =>
???
}
Expand Down
2 changes: 2 additions & 0 deletions src/mmt-stex/src/info/kwarc/mmt/stex/parsing/Rules.scala
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,10 @@ object TeXRules {
SkipCommand("DeclareRobustCommand", "vv"),
SkipCommand("NewDocumentEnvironment", "vvvv"),
SkipCommand("DeclareDocumentEnvironment", "vvvv"),

SkipCommand("hbox","t"),SkipCommand("vbox","t"),SkipCommand("fbox","t"),SkipCommand("text","t"),
SkipCommand("texttt","t"),SkipCommand("ensuremath","m"),SkipCommand("scalebox","vt"),

SkipCommand("ref", "v"), SkipCommand("label", "v"), SkipCommand("cite", "v"),
SkipCommand("includegraphics","ov"),SkipCommand("url","ov")
)
Expand Down

0 comments on commit 92ef583

Please sign in to comment.