Project

General

Profile

« Previous | Next » 

Revision def5cf3f

Added by Andreas Kohlbecker over 8 years ago

further cleaning up

View differences:

src/main/java/org/bgbm/biovel/drf/checklist/EEA_BDC_Client.java
7 7
import java.util.Iterator;
8 8
import java.util.List;
9 9

  
10
import org.apache.jena.rdf.model.Model;
11
import org.apache.jena.rdf.model.Resource;
12 10
import org.apache.lucene.queryParser.QueryParser;
13 11
import org.bgbm.biovel.drf.client.ServiceProviderInfo;
14 12
import org.bgbm.biovel.drf.query.TinkerPopClient;
......
306 304
        TaxonName taxonName = new TaxonName();
307 305
        // TaxonName
308 306
        taxonName.setFullName(queryClient.relatedVertexValue(v, RdfSchema.RDFS, "label"));
309
        // TODO rename CanonicalName to scientificName? compare with dwc:scientificName
310 307
        taxonName.setCanonicalName(queryClient.relatedVertexValue(v, RdfSchema.EUNIS_SPECIES, "binomialName"));
311 308
        taxonName.setRank(queryClient.relatedVertexValue(v, RdfSchema.EUNIS_SPECIES, "taxonomicRank"));
312 309
        return taxonName;
......
351 348

  
352 349
    }
353 350

  
354
    /**
355
     * Returns all subjects that are related to the taxonR
356
     * via the es:eunisPrimaryName property.
357
     *
358
     * @param taxonR
359
     * @return
360
     */
361
    private List<Resource> queryForSynonyms(Resource taxonR) {
362
 /* FIXME
363
        List<Resource> synonymRList = null;
364

  
365
        try {
366
            StringBuilder queryString = prepareQueryString();
367

  
368
            queryString.append("DESCRIBE ?synonym es:eunisPrimaryName <" + taxonR.getURI() + ">");
369
            logger.debug("\n" + queryString.toString());
370

  
371
            Model model = queryClient.describe(queryString.toString());
372
            synonymRList = listSynonymResources(model, taxonR);
373

  
374
        } catch (DRFChecklistException e) {
375
            logger.error("SPARQL query error in queryForSynonyms()", e);
376
        } finally {
377
            if(synonymRList == null) {
378
                synonymRList = new ArrayList<Resource>(0);
379
            }
380
        }
381

  
382
        return synonymRList;
383
*/ return null;
384
    }
385

  
386
    /**
387
     * @param model
388
     * @return
389
     */
390
    private List<Resource> listSynonymResources(Model model, Resource taxonR) {
391
        List<Resource> synonymRList;
392
        /*
393
        Property filterProperty = model.createProperty(RdfSchema.EUNIS_SPECIES.schemaUri, "eunisPrimaryName");
394
        synonymRList = queryClient.listResources(model, filterProperty, null, taxonR);
395
        return synonymRList;
396
         */
397
        return null;
398
    }
399

  
400 351
    @Override
401 352
    public void resolveScientificNamesExact(TnrMsg tnrMsg) throws DRFChecklistException {
402 353

  
403
        List<Query> queryList = tnrMsg.getQuery();
404

  
405
        // selecting one request as representative, only
406
        // the search mode and addSynonmy flag are important
407
        // for the further usage of the request object
408

  
409 354
        for (ServiceProviderInfo checklistInfo : getServiceProviderInfo().getSubChecklists()) {
410 355

  
356
            // FIXME query specific subchecklist
357

  
358
            // selecting one request as representative, only
359
            // the search mode and addSynonmy flag are important
360
            // for the further usage of the request object
411 361
            Query query = singleQueryFrom(tnrMsg);
412 362

  
413 363
            String queryString = query.getRequest().getQueryString();
......
449 399

  
450 400
        for (ServiceProviderInfo checklistInfo : getServiceProviderInfo().getSubChecklists()) {
451 401

  
402
            // FIXME query specific subchecklist
403

  
452 404
            // selecting one request as representative, only
453 405
            // the search mode and addSynonmy flag are important
454 406
            // for the further usage of the request object
......
553 505
     * @param matchNode
554 506
     * @return
555 507
     */
556
    @SuppressWarnings("unused")
557 508
    private Response tnrResponseFromResource(Vertex taxonV, Request request, Vertex matchNode, NameType matchType) {
558 509

  
559 510
        Response tnrResponse = TnrMsgUtils.tnrResponseFor(getServiceProviderInfo());
560 511

  
561
        SearchMode searchMode = SearchMode.valueOf(request.getSearchMode());
562

  
563 512
        GremlinPipeline<Graph, Vertex> pipe = new GremlinPipeline<Graph, Vertex>(taxonV);
564 513

  
565 514
        String validName = queryClient.relatedVertexValue(taxonV, RdfSchema.EUNIS_SPECIES, "validName");

Also available in: Unified diff