use of org.apache.spark.api.java.function.FilterFunction in project bunsen by cerner.
the class ConceptMaps method getMappings.
/**
* Returns a dataset with the mappings for each uri and version.
*
* @param uriToVersion a map of concept map URI to the version to load
* @return a dataset of mappings for the given URIs and versions.
*/
public Dataset<Mapping> getMappings(Map<String, String> uriToVersion) {
JavaSparkContext context = new JavaSparkContext(this.spark.sparkContext());
Broadcast<Map<String, String>> broadcastMaps = context.broadcast(uriToVersion);
return this.mappings.filter((FilterFunction<Mapping>) mapping -> {
String latestVersion = broadcastMaps.getValue().get(mapping.getConceptMapUri());
return latestVersion != null && latestVersion.equals(mapping.getConceptMapVersion());
});
}
use of org.apache.spark.api.java.function.FilterFunction in project bunsen by cerner.
the class ValueSets method getValues.
/**
* Returns a dataset with the values for each element in the map of uri to version.
*
* @param uriToVersion a map of value set URI to the version to load
* @return a dataset of values for the given URIs and versions.
*/
public Dataset<Value> getValues(Map<String, String> uriToVersion) {
JavaSparkContext context = new JavaSparkContext(this.spark.sparkContext());
Broadcast<Map<String, String>> broadcastUrisToVersion = context.broadcast(uriToVersion);
return this.values.filter((FilterFunction<Value>) value -> {
String latestVersion = broadcastUrisToVersion.getValue().get(value.getValueSetUri());
return latestVersion != null && latestVersion.equals(value.getValueSetVersion());
});
}
Aggregations