Skip to content

Commit

Permalink
Use build server instead of file based IRI (#110)
Browse files Browse the repository at this point in the history
* Use build server instead of file based IRI

* Apply same change to W5TurtleGenerator

Co-authored-by: dotasek <[email protected]>
  • Loading branch information
dotasek and dotasek authored Jan 12, 2023
1 parent 1d563cf commit a959487
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.hl7.fhir.rdf.RDFNamespace;
import org.hl7.fhir.rdf.RDFTypeMap;
import org.hl7.fhir.tools.publisher.BuildWorkerContext;
import org.hl7.fhir.tools.publisher.PageProcessor;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;

Expand Down Expand Up @@ -111,16 +112,21 @@ public void executeMain() throws Exception {
commit(true);
}

/**
* Emit an ontology definition for the file
*/
/**
* Emit an ontology definition for the file
*/
private void genOntologyDefinition() {
fact.fhir_ontology("fhir.ttl", "FHIR Model Ontology")
.addDataProperty(RDFS.comment, "Formal model of FHIR Clinical Resources")
.addObjectProperty(OWL2.versionIRI, ResourceFactory.createResource(host+"fhir.ttl"))
.addObjectProperty(OWL2.versionIRI, ResourceFactory.createResource(getOntologyVersionIRI() +"fhir.ttl"))
.addObjectProperty(OWL2.imports, ResourceFactory.createResource("http://hl7.org/fhir/w5.ttl"));
}

private String getOntologyVersionIRI() {
return host.startsWith("file:") ?
PageProcessor.CI_LOCATION : host;
}

/**
* Emit all the basic atoms that are implicit in the actual model
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.rdf.RDFNamespace;
import org.hl7.fhir.tools.publisher.BuildWorkerContext;
import org.hl7.fhir.tools.publisher.PageProcessor;
import org.hl7.fhir.utilities.validation.ValidationMessage;

/**
Expand Down Expand Up @@ -61,7 +62,7 @@ public void executeMain() throws Exception {
w5.addProperty(RDFS.label, "W5 Categorization");
w5.addProperty(RDFS.comment, "FHIR W5 categorization is a preliminary classification of the fhir property");
w5.addVersionInfo("FHIR W5 categorization (Preliminary)");
w5.addProperty(OWL2.versionIRI, host+"w5.ttl");
w5.addProperty(OWL2.versionIRI, getOntologyVersionIRI()+"w5.ttl");

// The only way to differentiate predicates from classes is the existence of subclasses -- if something
// has subclasses or is a subclass then it is a class. Otherwise it is a predicate...
Expand Down Expand Up @@ -109,6 +110,11 @@ public void executeMain() throws Exception {
commit(model, true);
}


private String getOntologyVersionIRI() {
return host.startsWith("file:") ?
PageProcessor.CI_LOCATION : host;
}
public void commit(OntModel model, boolean header) throws Exception {
RDFDataMgr.write(destination, model, RDFFormat.TURTLE_PRETTY);
destination.flush();
Expand Down

0 comments on commit a959487

Please sign in to comment.