Skip to content

Commit

Permalink
Merge pull request #697 from EBISPOT/fix-693
Browse files Browse the repository at this point in the history
Fix for #693.
  • Loading branch information
henrietteharmse authored Jul 11, 2024
2 parents 56a60e3 + 829f40c commit e5c4a2e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public void search(
@RequestParam(value = "lang", defaultValue = "en") String lang,
HttpServletResponse response
) throws IOException, SolrServerException {
System.out.println("fieldList 1 = " + fieldList);
System.out.println("type = " + types);

final SolrQuery solrQuery = new SolrQuery(); // 1

Expand Down Expand Up @@ -206,15 +208,15 @@ public void search(
* Fix: End
*/
solrQuery.add("wt", format);
System.out.println("fieldList 2 = " + fieldList);


System.out.println(solrQuery.jsonStr());
System.out.println("solrQuery=" + solrQuery.jsonStr());

QueryResponse qr = solrClient.dispatchSearch(solrQuery, "ols4_entities");

List<Object> docs = new ArrayList<>();
for(SolrDocument res : qr.getResults()) {

System.out.println("res = " + res.toString());
String _json = (String)res.get("_json");
if(_json == null) {
throw new RuntimeException("_json was null");
Expand Down Expand Up @@ -256,7 +258,9 @@ public void search(
if (fieldList.contains("obo_id")) outDoc.put("obo_id", JsonHelper.getString(json, "curie"));
if (fieldList.contains("is_defining_ontology")) outDoc.put("is_defining_ontology",
JsonHelper.getString(json, "isDefiningOntology") != null && JsonHelper.getString(json, "isDefiningOntology").equals("true"));
if (fieldList.contains("type")) outDoc.put("type", "class");
if (fieldList.contains("type")) {
outDoc.put("type", JsonHelper.getType(json, "type"));
}
if (fieldList.contains("synonym")) outDoc.put("synonym", JsonHelper.getStrings(json, "synonym"));
if (fieldList.contains("ontology_prefix")) outDoc.put("ontology_prefix", JsonHelper.getString(json, "ontologyPreferredPrefix"));
if (fieldList.contains("subset")) outDoc.put("subset", JsonHelper.getStrings(json, "http://www.geneontology.org/formats/oboInOwl#inSubset"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ public void select(
if (fieldList.contains("obo_id")) outDoc.put("obo_id", JsonHelper.getString(json, "curie"));
if (fieldList.contains("is_defining_ontology")) outDoc.put("is_defining_ontology",
JsonHelper.getString(json, "isDefiningOntology") != null && JsonHelper.getString(json, "isDefiningOntology").equals("true"));
if (fieldList.contains("type")) outDoc.put("type", "class");
if (fieldList.contains("type")) {
outDoc.put("type", JsonHelper.getType(json, "type"));
}
if (fieldList.contains("synonym")) outDoc.put("synonym", JsonHelper.getStrings(json, "synonym"));
if (fieldList.contains("ontology_prefix")) outDoc.put("ontology_prefix", JsonHelper.getString(json, "ontologyPreferredPrefix"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ public static List<String> getStrings(JsonObject json, String predicate) {
return getValues(json, predicate).stream().map(JsonHelper::objectToString).collect(Collectors.toList());
}

/**
* This methi
* @param json
* @param predicate
* @return
*/
public static String getType(JsonObject json, String predicate){
List<String> types = getValues(json, predicate).stream().map(JsonHelper::objectToString).collect(Collectors.toList());
types.remove("entity");
return types.get(0);
}

public static List<JsonObject> getObjects(JsonObject json, String predicate) {
return getValues(json, predicate).stream().map(v -> v.getAsJsonObject()).collect(Collectors.toList());
}
Expand Down
59 changes: 59 additions & 0 deletions dataload/configs/gaz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"ontologies": [
{
"activity_status": "inactive",
"build": {
"method": "archive",
"path": "archive",
"source_url": "http://build.berkeleybop.org/job/build-gaz/lastSuccessfulBuild/artifact/*zip*/archive.zip"
},
"contact": {
"email": "[email protected]",
"github": "lschriml",
"label": "Lynn Schriml",
"orcid": "0000-0001-8910-9851"
},
"description": "A gazetteer constructed on ontological principles",
"homepage": "http://environmentontology.github.io/gaz/",
"id": "gaz",
"preferredPrefix": "GAZ",
"layout": "ontology_detail",
"license": {
"label": "CC0 1.0",
"logo": "http://mirrors.creativecommons.org/presskit/buttons/80x15/png/cc-zero.png",
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
},
"mailing_list": "https://groups.google.com/forum/#!forum/obo-gazetteer",
"ontology_purl": "http://purl.obolibrary.org/obo/gaz.owl",
"products": [
{
"id": "gaz.owl",
"ontology_purl": "http://purl.obolibrary.org/obo/gaz.owl"
},
{
"id": "gaz.obo",
"ontology_purl": "http://purl.obolibrary.org/obo/gaz.obo"
}
],
"repository": "https://github.com/EnvironmentOntology/gaz",
"title": "Gazetteer",
"tracker": "https://github.com/EnvironmentOntology/gaz/issues",
"hierarchical_property":[
"http://purl.obolibrary.org/obo/BFO_0000050",
"http://purl.obolibrary.org/obo/RO_0001025",
"http://purl.obolibrary.org/obo/RO_0002151",
"http://purl.obolibrary.org/obo/RO_0002376",
"http://purl.obolibrary.org/obo/RO_0002377",
"http://purl.obolibrary.org/obo/UBREL_0000001",
"http://purl.obolibrary.org/obo/RO_0002219",
"http://purl.obolibrary.org/obo/RO_0002379",
"http://purl.obolibrary.org/obo/RO_0002378",
"http://purl.obolibrary.org/obo/RO_0002090",
"http://purl.obolibrary.org/obo/TEMP#proper_partof",
"http://purl.obolibrary.org/obo/TEMP#overlapped_by",
"http://purl.obolibrary.org/obo/RO_0002131",
"http://purl.obolibrary.org/obo/RO_0002220"
]
}
]
}

0 comments on commit e5c4a2e

Please sign in to comment.