Skip to content

Commit

Permalink
Schema packaging: remove the theme taxonomy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostrzyciel committed May 15, 2024
1 parent a605a4d commit bc19a96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/main/scala/commands/PackageSchemaCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object PackageSchemaCommand extends Command:
val outDir = FileSystems.getDefault.getPath(args(3))
val docOutDir = FileSystems.getDefault.getPath(args(4))

val toProcessNames = Seq("metadata", "documentation", "theme") ++
val toProcessNames = Seq("metadata", "documentation") ++
repoDir.resolve("src/shacl").toFile.listFiles()
.filter(f => f.isFile && f.getName.endsWith(".ttl"))
.map(f => "shacl/" + f.getName.replace(".ttl", ""))
Expand Down Expand Up @@ -92,17 +92,16 @@ object PackageSchemaCommand extends Command:
true

private def prepOntologyForDoc(m: Model, name: String, outDir: Path): Unit =
if name != "theme" then
val externalSubjects = m.listSubjects().asScala
.filter(_.isURIResource)
.filter(!_.getURI.startsWith(AppConfig.CiWorker.rbRootUrl))
.map(_.listProperties().asScala.toSeq)
.filter(sts => sts.size == 1 && sts.head.getPredicate == RDF.`type`)
.map(sts => sts.head.getSubject.asResource)
.toSeq

for s <- externalSubjects do
m.removeAll(s, null, null)
val externalSubjects = m.listSubjects().asScala
.filter(_.isURIResource)
.filter(!_.getURI.startsWith(AppConfig.CiWorker.rbRootUrl))
.map(_.listProperties().asScala.toSeq)
.filter(sts => sts.size == 1 && sts.head.getPredicate == RDF.`type`)
.map(sts => sts.head.getSubject.asResource)
.toSeq

for s <- externalSubjects do
m.removeAll(s, null, null)

val os = new FileOutputStream(outDir.resolve(f"$name.ttl").toFile)
RDFDataMgr.write(os, m, RDFFormat.TURTLE)
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/util/RdfIoUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ object RdfIoUtil:
val ontologyPaths = Seq(
schemaRepoDir.resolve("src/metadata.ttl"),
schemaRepoDir.resolve("src/documentation.ttl"),
schemaRepoDir.resolve("src/theme.ttl"),
) ++ schemaRepoDir.resolve("src/imports").toFile.listFiles()
.filter(f => f.isFile && (f.getName.endsWith(".ttl") || f.getName.endsWith(".rdf")))
.map(_.toPath)
Expand Down

0 comments on commit bc19a96

Please sign in to comment.