@Override public Query query() { return new QueryImpl(this); }
@Override public long count() { return count(new QueryImpl()); }
@Override public Iterator<Entity> iterator() { return findAll(new QueryImpl()).iterator(); }
private DataSet getDataSetForWorkFlowElement(Integer workflowElementId) { // get data set for the given workflow element Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, workflowElementId, Protocol.class); Iterable<DataSet> dataSets = dataService.findAll(DataSet.ENTITY_NAME, new QueryImpl().eq(DataSet.PROTOCOLUSED, protocol), DataSet.class); if (Iterables.size(dataSets) != 1) throw new RuntimeException("Workflow element must have exactly one data set"); return dataSets.iterator().next(); } }
@RequestMapping(method = RequestMethod.POST, value = "/attribute", produces = APPLICATION_JSON_VALUE) @ResponseBody public SearchResult getOneAttribute(@RequestBody String featureId) { return searchService.search(new SearchRequest(null, new QueryImpl().eq(ObservableFeature.ID, featureId).and() .eq("type", "observablefeature"), null)); }
private Stream<GenomeBrowserAttributes> getDefaultGenomeBrowserAttributes() { return dataService.findAll( GenomeBrowserAttributesMetadata.GENOMEBROWSERATTRIBUTES, new QueryImpl<GenomeBrowserAttributes>().eq(GenomeBrowserAttributesMetadata.DEFAULT, true), GenomeBrowserAttributes.class); }
@Override public Iterator<Entity> iterator() { Query<Entity> q = new QueryImpl<>(); return findAllBatching(q).iterator(); }
@Override public Entity getOntologyEntity(String ontologyIri) { return dataService.findOne( ONTOLOGY, new QueryImpl<>().eq(OntologyMetaData.ONTOLOGY_IRI, ontologyIri)); }
@Override public Stream<AlgorithmTemplate> find(Hits<ExplainedAttribute> attrMatches) { // get all algorithm templates Stream<Script> jsScripts = dataService.findAll( SCRIPT, new QueryImpl<Script>().eq(TYPE, JsMagmaScriptRunner.NAME), Script.class); // select all algorithm templates that can be used with target and sources return jsScripts.flatMap(script -> toAlgorithmTemplate(script, attrMatches)); }
@Override public Stream<AlgorithmTemplate> find(Map<Attribute, ExplainedAttribute> attrMatches) { // get all algorithm templates Stream<Script> jsScripts = dataService .findAll(SCRIPT, new QueryImpl<Script>().eq(TYPE, JsMagmaScriptRunner.NAME), Script.class); // select all algorithm templates that can be used with target and sources return jsScripts.flatMap(script -> toAlgorithmTemplate(script, attrMatches)); }
public StoreMappingRepository(DataSet dataSet, DataService dataService) { super("mapping://" + dataSet.getIdentifier()); this.dataSet = dataSet; Iterable<ObservationSet> observationSets = dataService.findAll(ObservationSet.ENTITY_NAME, new QueryImpl().eq(ObservationSet.PARTOFDATASET, dataSet), ObservationSet.class); observedValues = dataService.findAll(ObservedValue.ENTITY_NAME, new QueryImpl().in(ObservedValue.OBSERVATIONSET, Lists.newArrayList(observationSets)), ObservedValue.class); valueConverter = new ValueConverter(dataService); }
private boolean viewExists(String viewName) { Queryable templateRepository = dataService.getQueryableRepository(FreemarkerTemplate.ENTITY_NAME); return templateRepository.count(new QueryImpl().eq("Name", viewName + ".ftl")) > 0; }
private String getOntologyTermNodePath(OntologyTerm ontologyTerm) { Entity ontologyTermEntity = dataService.findOne( ONTOLOGY_TERM, new QueryImpl<>().eq(ONTOLOGY_TERM_IRI, ontologyTerm.getIRI())); Iterable<Entity> ontologyTermNodePathEntities = ontologyTermEntity.getEntities(OntologyTermMetaData.ONTOLOGY_TERM_NODE_PATH); return ontologyTermNodePathEntities .iterator() .next() .getString(OntologyTermNodePathMetaData.NODE_PATH); }
/** Retrieves the query to get all index actions sorted */ static Query<IndexAction> createQueryGetAllIndexActions(String transactionId) { QueryRule rule = new QueryRule(INDEX_ACTION_GROUP_ATTR, EQUALS, transactionId); QueryImpl<IndexAction> q = new QueryImpl<>(rule); q.setSort(new Sort(ACTION_ORDER)); return q; }
@Override public void loadCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, true); }
@Override public void activateCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, true); } }
@Override public boolean isCatalogLoaded(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); return protocol.getActive(); }
@Override public void deactivateCatalog(String id) throws UnknownCatalogException { Protocol protocol = dataService.findOne(Protocol.ENTITY_NAME, new QueryImpl().eq(Protocol.ID, id), Protocol.class); if (protocol == null) throw new UnknownCatalogException("Catalog [" + id + "] does not exist"); setProtocolActive(protocol, false); }
private SearchResult findAllFeatures(Integer targetDataSetId) { QueryImpl query = new QueryImpl(); query.addRule(new QueryRule(ENTITY_TYPE, Operator.EQUALS, ObservableFeature.class.getSimpleName().toLowerCase())); query.pageSize(1000000); DataSet dataSet = dataService.findOne(DataSet.ENTITY_NAME, targetDataSetId, DataSet.class); return searchService .search(new SearchRequest(CATALOGUE_PREFIX + dataSet.getProtocolUsed().getId(), query, null)); }
@Override public Entity findOneById(Object id, Fetch fetch) { if (id == null) { return null; } return findOne(new QueryImpl<>().eq(entityType.getIdAttribute().getName(), id).fetch(fetch)); }