-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #595 from EBISPOT/dev
Annotations_trimmed, zooma fix
- Loading branch information
Showing
14 changed files
with
156 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...json/src/main/java/uk/ac/ebi/rdf2json/annotators/SearchableAnnotationValuesAnnotator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package uk.ac.ebi.rdf2json.annotators; | ||
|
||
import uk.ac.ebi.rdf2json.OntologyGraph; | ||
import uk.ac.ebi.rdf2json.OntologyNode; | ||
import uk.ac.ebi.rdf2json.properties.PropertyValue; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static uk.ac.ebi.rdf2json.properties.PropertyValue.Type.LITERAL; | ||
|
||
public class SearchableAnnotationValuesAnnotator { | ||
|
||
// Roughly equivalent to "annotations_trimmed" in OLS3. | ||
// | ||
// A field that contains a list of just the values (no predicates) of all of the "annotations" (which is not a well | ||
// defined term, so we have to make it up) of an entity. | ||
// | ||
// This field is used for solr searching, so that you can search for the value of any property (regardless of how | ||
// important OLS thinks it is), and still expect a result. | ||
// | ||
public static void annotateSearchableAnnotationValues(OntologyGraph graph) { | ||
|
||
long startTime3 = System.nanoTime(); | ||
for(String id : graph.nodes.keySet()) { | ||
OntologyNode c = graph.nodes.get(id); | ||
if(c.types.contains(OntologyNode.NodeType.CLASS) || | ||
c.types.contains(OntologyNode.NodeType.PROPERTY) || | ||
c.types.contains(OntologyNode.NodeType.INDIVIDUAL) || | ||
c.types.contains(OntologyNode.NodeType.ONTOLOGY)) { | ||
|
||
List<PropertyValue> values = new ArrayList<>(); | ||
|
||
for(var predicate : c.properties.getPropertyPredicates()) { | ||
|
||
// namespaces that are NOT considered annotations for this exercise... | ||
// | ||
if(predicate.startsWith("http://www.w3.org/1999/02/22-rdf-syntax-ns#") | ||
|| predicate.startsWith("http://www.w3.org/2000/01/rdf-schema#") | ||
|| predicate.startsWith("http://www.w3.org/2002/07/owl#")) { | ||
|
||
continue; | ||
} | ||
|
||
for(var value : c.properties.getPropertyValues(predicate)) { | ||
if(value.getType().equals(LITERAL)) { | ||
values.add(value); | ||
} | ||
} | ||
} | ||
|
||
for(var value : values) { | ||
c.properties.addProperty("searchableAnnotationValues", value); | ||
} | ||
} | ||
} | ||
|
||
long endTime3 = System.nanoTime(); | ||
System.out.println("annotate searchable annotation values: " + ((endTime3 - startTime3) / 1000 / 1000 / 1000)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters