Skip to content

Commit

Permalink
accessing config using the getter method instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Camilo Chirino committed Sep 28, 2016
2 parents 13733e8 + 7d0abc9 commit 4ccb4bc
Show file tree
Hide file tree
Showing 34 changed files with 804 additions and 402 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<classpathentry kind="lib" path="lib/jena/xercesImpl-2.7.1.jar"/>
<classpathentry kind="lib" path="lib/jgrapht-jdk1.5.jar"/>
<classpathentry kind="lib" path="lib/org.apache.commons.io.jar"/>
<classpathentry kind="lib" path="lib/owlapi-bin.jar" sourcepath="C:/_CiRM/y. tools/OWL API 3.2.4/owlapi-src.jar"/>
<classpathentry kind="lib" path="lib/owlapi-bin.jar" sourcepath="C:/_311Hub/y. tools/OWL API 3.2.4/owlapi-src.jar"/>
<classpathentry kind="lib" path="lib/pellet-cli.jar"/>
<classpathentry kind="lib" path="lib/pellet-core.jar"/>
<classpathentry kind="lib" path="lib/pellet-datatypes.jar"/>
Expand Down
2 changes: 1 addition & 1 deletion conf/devconfig.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ontoServer":"ontology_server_test",
"password":"N/A",
"user":"cirmservice_test",
"serverUrl":"s0141667"},
"serverUrl":"s0144818"},
"keystore":"cirm.jks",
"storePass":"password",
"ontologyConfigSet":"http://www.miamidade.gov/ontology#TestConfigSet",
Expand Down
2 changes: 1 addition & 1 deletion conf/metadb.p2p
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"user" : "CiRMDevelopmentOntology",
"password" : "cirm",
"serverUrl" : "s0141667.miamidade.gov",
"serverUrl" : "s0144818.miamidade.gov",
"autoRegister" : true,
"ignoreRoster" : false
}
Expand Down
2 changes: 1 addition & 1 deletion conf/prodconfig.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ontologyConfigSet":"http://www.miamidade.gov/ontology#ProdConfigSet",
"network" : { "user": "cirmservice_production",
"password":"N/A",
"serverUrl":"s0141667",
"serverUrl":"s0144818",
"ontoServer":"ontology_server_production"},
"ontologyPrefixes": {
"legacy:" : "http://www.miamidade.gov/cirm/legacy#",
Expand Down
2 changes: 1 addition & 1 deletion conf/testconfig.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"ontologyConfigSet":"http://www.miamidade.gov/ontology#TestConfigSet",
"network" : { "user", "cirmservice_production",
"password","N/A",
"serverUrl","s0141667",
"serverUrl","s0144818",
"ontoServer","ontology_server_production"},
"ontologyPrefixes": {
"legacy:" : "http://www.miamidade.gov/cirm/legacy#",
Expand Down
4 changes: 2 additions & 2 deletions src/html/srmarkup.ht
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ HTML templates
<label data-bind="text: hasServiceField().label(), css: {highlight_text : $root.isHighlighted($data)} "></label>
</div>
<div class="grid_5 alpha">
<input placeholder="" class="tooltip" data-bind="value: hasAnswerValue().literal, valueUpdate: 'afterkeydown', css: { error: hasAnswerValue().literal.hasError }, attr :{title: hasAnswerValue().literal }" ></input>
<input placeholder="" class="tooltip" data-bind="value: hasAnswerValue().literal, valueUpdate: 'afterkeydown', hasfocus: hasAnswerValue().literal.hasInputFocus, css: { error: hasAnswerValue().literal.hasError }, attr :{title: hasAnswerValue().literal.toolTipTitle }" ></input>
</div>
<div class="grid_1 omega">
<label data-bind='visible: hasAnswerValue().literal.hasError, text: hasAnswerValue().literal.validationMessage, css: { red_text: hasAnswerValue().literal.hasError }' />
Expand All @@ -814,7 +814,7 @@ HTML templates
</div>
<div class="grid_5 alpha">
<span class="input_clear">
<input placeholder="" class="ic_field tooltip" style="width:340px" data-bind="value: hasAnswerValue().literal, valueUpdate: 'afterkeydown', event: {keydown: $root.standardizeStreet}, css: { error: hasAnswerValue().literal.hasError }, attr :{title: hasAnswerValue().literal, id:hasLegacyCode }" ></input>
<input placeholder="" class="ic_field tooltip" style="width:340px" data-bind="value: hasAnswerValue().literal, valueUpdate: 'afterkeydown', hasfocus: hasAnswerValue().literal.hasInputFocus, event: {keydown: $root.standardizeStreet}, css: { error: hasAnswerValue().literal.hasError }, attr :{title: hasAnswerValue().literal.toolTipTitle, id:hasLegacyCode }" ></input>
<input class="submit" type="button" value="Search" data-bind="click: $root.getStandardizeStreet" title="Click to validate the Street">
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/java/org/sharegov/cirm/ConfigSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static synchronized ConfigSet getInstance()
if (activeInstance == null)
{
ConfigSet newConfigSet = new ConfigSet();
String instanceName = StartUp.config.at("ontologyConfigSet").asString();
String instanceName = StartUp.getConfig().at("ontologyConfigSet").asString();
loadInstance(instanceName, newConfigSet);
//safe publication
activeInstance = newConfigSet;
Expand Down
32 changes: 16 additions & 16 deletions src/java/org/sharegov/cirm/OWL.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ private static synchronized void initChecked()
{
if (!initialized)
{
if (StartUp.config.has("metaDatabaseLocation"))
if (StartUp.getConfig().has("metaDatabaseLocation"))
{
if (!VDHGDBOntologyRepository.hasInstance())
{
//Initialisation of repository location before everything else:
if (HGEnvironment.exists(StartUp.config.at("metaDatabaseLocation").asString()))
if (HGEnvironment.exists(StartUp.getConfig().at("metaDatabaseLocation").asString()))
{
VDHGDBOntologyRepository.setHypergraphDBLocation(StartUp.config.at("metaDatabaseLocation").asString());
VDHGDBOntologyRepository.setHypergraphDBLocation(StartUp.getConfig().at("metaDatabaseLocation").asString());
}
else
{
Expand All @@ -163,7 +163,7 @@ private static synchronized void initChecked()
{
// TODO: hard-coded list, we need to have this in bootstrap JSON config.
repo.createRepositoryFromDefaultPeer(
StartUp.config.at("metaDatabaseLocation").asString(),
StartUp.getConfig().at("metaDatabaseLocation").asString(),
new HashSet<IRI>(Arrays.asList(
IRI.create("http://www.miamidade.gov/ontology"),
IRI.create("http://www.miamidade.gov/cirm/legacy"))));
Expand All @@ -183,9 +183,9 @@ private static synchronized void initChecked()
//Assert Factory is SynchronizedOWLDataFactory or HGDB and threadsafe.
OWLDataFactoryHGDB.getInstance().ignoreOntologyScope(true);
loader = new OntologyLoader(manager);
if (StartUp.config.has("customIRIMappingFile"))
if (StartUp.getConfig().has("customIRIMappingFile"))
{
String customIRIMappingFile = StartUp.config.at("customIRIMappingFile").asString();
String customIRIMappingFile = StartUp.getConfig().at("customIRIMappingFile").asString();
manager.addIRIMapper(CustomOWLOntologyIRIMapper.createFrom(new File(customIRIMappingFile)));
}
DEFAULT_STOP_EXPANSION_CONDITION = getInitializedDefaultStopExpansionCondition(factory);
Expand All @@ -197,9 +197,9 @@ private static OWLObjectPropertyCondition getInitializedDefaultStopExpansionCond
{

Set<OWLObjectProperty> stopExpansionProps = new HashSet<OWLObjectProperty>();
if (StartUp.config.has("stopExpansionConditionIRI"))
if (StartUp.getConfig().has("stopExpansionConditionIRI"))
{
for(Object iri : StartUp.config.at("stopExpansionConditionIRI").asList())
for(Object iri : StartUp.getConfig().at("stopExpansionConditionIRI").asList())
{
stopExpansionProps.add(factory.getOWLObjectProperty(IRI.create((String)iri)));
}
Expand All @@ -218,20 +218,20 @@ public static PrefixManager prefixManager()
{

DefaultPrefixManager pm = new DefaultPrefixManager(manager.getOntologyFormat(ontology()).asPrefixOWLOntologyFormat());
if (StartUp.config.has("ontologyPrefixes"))
for (Map.Entry<String, Json> e : StartUp.config.at("ontologyPrefixes", Json.object()).asJsonMap().entrySet())
if (StartUp.getConfig().has("ontologyPrefixes"))
for (Map.Entry<String, Json> e : StartUp.getConfig().at("ontologyPrefixes", Json.object()).asJsonMap().entrySet())
if (!e.getKey().equals(":") && pm.getPrefix(e.getKey()) != null && !e.getValue().asString().equals(pm.getPrefix(e.getKey())))
throw new RuntimeException("Prefix clash between default ontology and startup configuration: " + e.getKey());
else
pm.setPrefix(e.getKey(), e.getValue().asString());
prefixManager = pm;
// if (!StartUp.config.has("metaDatabaseLocation") && manager.getOntologyFormat(ontology()) != null &&
// if (!StartUp.getConfig().has("metaDatabaseLocation") && manager.getOntologyFormat(ontology()) != null &&
// manager.getOntologyFormat(ontology()).isPrefixOWLOntologyFormat())
// prefixManager = new DefaultPrefixManager(manager.getOntologyFormat(ontology()).asPrefixOWLOntologyFormat());
// else
// {
// DefaultPrefixManager pm = new DefaultPrefixManager();
// for (Map.Entry<String, Json> e : StartUp.config.at("ontologyPrefixes", Json.object()).asJsonMap().entrySet())
// for (Map.Entry<String, Json> e : StartUp.getConfig().at("ontologyPrefixes", Json.object()).asJsonMap().entrySet())
// pm.setPrefix(e.getKey(), e.getValue().asString());
// prefixManager = pm;
// }
Expand Down Expand Up @@ -313,7 +313,7 @@ public static IRI fullIri(String s)
{
return prefixManager().getIRI(s);
}
return fullIri(s, StartUp.config.at("nameBase").asString());
return fullIri(s, StartUp.getConfig().at("nameBase").asString());
}

public static IRI fullIri(String s, String ontologyIri)
Expand Down Expand Up @@ -435,7 +435,7 @@ public static Set<OWLOntology> ontologies()
* @return the found NamedIndividual or NULL if not found.
*/
public static OWLNamedIndividual findNamedIndividualByFragment(String iRIfragment) {
Map<String, Object> ontoPrefixes = StartUp.config.at("ontologyPrefixes").asMap();
Map<String, Object> ontoPrefixes = StartUp.getConfig().at("ontologyPrefixes").asMap();
for (Object prefixIri : ontoPrefixes.values()) {
IRI indIRI = IRI.create("" + prefixIri + iRIfragment);
if (ontology().containsIndividualInSignature(indIRI, true)) {
Expand Down Expand Up @@ -1730,8 +1730,8 @@ else if(j.has(propName) && j.at(propName).isObject())
public static void main(String [] args)
{
// if( (args.length > 0) )
// StartUp.config = Json.read(GenUtils.readTextFile(new File("c:/work/cirmservices/conf/devconfig.json")));
// System.out.println("Using config " + StartUp.config.toString());
// StartUp.getConfig() = Json.read(GenUtils.readTextFile(new File("c:/work/cirmservices/conf/devconfig.json")));
// System.out.println("Using config " + StartUp.getConfig().toString());
// System.out.println(OWL.queryIndividuals("hasLegacyInterface value MDC-CMS"));
OWL.init();
OWLOntology O = ontology();
Expand Down
14 changes: 7 additions & 7 deletions src/java/org/sharegov/cirm/OntologyLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ public OntologyLoader(OWLOntologyManager manager)
{
// TODO: all this should be in customIRIMappings file only..
locations.put(IRI.create("http://www.miamidade.gov/cirm/legacy"),
new File(StartUp.config.at("workingDir").asString() + "/src/ontology/legacy.owl"));
new File(StartUp.getConfig().at("workingDir").asString() + "/src/ontology/legacy.owl"));
locations.put(IRI.create("http://www.miamidade.gov/ontology"),
new File(StartUp.config.at("workingDir").asString() + "/src/ontology/County_Working.owl"));
new File(StartUp.getConfig().at("workingDir").asString() + "/src/ontology/County_Working.owl"));
locations.put(IRI.create("http://www.miamidade.gov/ontology/pkbi"),
new File(StartUp.config.at("workingDir").asString() + "/src/County_Working_PKBI.owl"));
new File(StartUp.getConfig().at("workingDir").asString() + "/src/County_Working_PKBI.owl"));
locations.put(IRI.create("http://www.miamidade.gov/users/enet"),
new File(StartUp.config.at("workingDir").asString() + "/src/ontology/enet.owl"));
new File(StartUp.getConfig().at("workingDir").asString() + "/src/ontology/enet.owl"));

this.manager = manager;
boolean hgdbManager = false;
Expand Down Expand Up @@ -120,7 +120,7 @@ public File findFile(String iriString)
return f;
String prefix = Refs.nameBase.resolve() + "/swrl/";
if (iriString.startsWith(prefix))
return new File(new File(StartUp.config.at("workingDir").asString() + "/src/ontology"),
return new File(new File(StartUp.getConfig().at("workingDir").asString() + "/src/ontology"),
iriString.substring(prefix.length()) + ".swrl");
f = new File(iriString);
return f.exists() ? f : null;
Expand All @@ -137,7 +137,7 @@ public synchronized void unload(IRI iri)
public synchronized OWLOntology get(String iriString)
{
IRI iri = IRI.create(iriString);
if (StartUp.config.has("metaDatabaseLocation"))
if (StartUp.getConfig().has("metaDatabaseLocation"))
{
try
{
Expand Down Expand Up @@ -242,7 +242,7 @@ public Set<IRI> allSWRL()
{

Set<IRI> result = new HashSet<IRI>();
String dir = StartUp.config.at("workingDir").asString() + "/src/ontology";
String dir = StartUp.getConfig().at("workingDir").asString() + "/src/ontology";
String[] files = new File(dir).list(new FilenameFilter()
{
@Override
Expand Down
6 changes: 3 additions & 3 deletions src/java/org/sharegov/cirm/Refs.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class Refs
public static final String hasQueryExpression = Model.upper("hasQueryExpression").toString();

public static final Ref<String> nameBase = new Ref<String>() {
public String resolve() { return StartUp.config.at("nameBase").asString(); }
public String resolve() { return StartUp.getConfig().at("nameBase").asString(); }
};

public static final Ref<OWLOntology> topOntology = new Ref<OWLOntology>() {
Expand All @@ -81,7 +81,7 @@ public String resolve()
public static final Ref<String> defaultOntologyIRI = new Ref<String>() {
public String resolve()
{
return StartUp.config.at("defaultOntologyIRI").asString();
return StartUp.getConfig().at("defaultOntologyIRI").asString();
}
};

Expand Down Expand Up @@ -149,7 +149,7 @@ public OWLOntologyManager resolve() {
new SingletonRef<OWLSerialEntityCache>(new OWLSerialEntityCache());

public static final Ref<OwlRepo> owlRepo = new SingletonRef<OwlRepo>(
StartUp.config.has("metaDatabaseLocation") ?
StartUp.getConfig().has("metaDatabaseLocation") ?
OwlRepo.getInstance() : null);

public static final Ref<OntologyTransformer> ontologyTransformer =
Expand Down
Loading

0 comments on commit 4ccb4bc

Please sign in to comment.