Project

General

Profile

Download (22 KB) Statistics
| Branch: | Tag: | Revision:
1
package org.cybertaxonomy.utis.checklist;
2

    
3
import java.io.PrintStream;
4
import java.net.URI;
5
import java.util.ArrayList;
6
import java.util.EnumSet;
7
import java.util.Iterator;
8
import java.util.List;
9

    
10
import org.apache.lucene.queryParser.QueryParser;
11
import org.cybertaxonomy.utis.client.ServiceProviderInfo;
12
import org.cybertaxonomy.utis.query.TinkerPopClient;
13
import org.cybertaxonomy.utis.store.Neo4jStore;
14
import org.cybertaxonomy.utis.store.Store;
15
import org.cybertaxonomy.utis.tnr.msg.Classification;
16
import org.cybertaxonomy.utis.tnr.msg.NameType;
17
import org.cybertaxonomy.utis.tnr.msg.Query;
18
import org.cybertaxonomy.utis.tnr.msg.Response;
19
import org.cybertaxonomy.utis.tnr.msg.Source;
20
import org.cybertaxonomy.utis.tnr.msg.Synonym;
21
import org.cybertaxonomy.utis.tnr.msg.Taxon;
22
import org.cybertaxonomy.utis.tnr.msg.TaxonBase;
23
import org.cybertaxonomy.utis.tnr.msg.TaxonName;
24
import org.cybertaxonomy.utis.tnr.msg.TnrMsg;
25
import org.cybertaxonomy.utis.tnr.msg.Query.Request;
26
import org.cybertaxonomy.utis.utils.IdentifierUtils;
27
import org.cybertaxonomy.utis.utils.Profiler;
28
import org.cybertaxonomy.utis.utils.TnrMsgUtils;
29
import org.neo4j.graphdb.Relationship;
30

    
31
import com.tinkerpop.blueprints.Graph;
32
import com.tinkerpop.blueprints.Vertex;
33
import com.tinkerpop.blueprints.impls.neo4j2.Neo4j2Vertex;
34
import com.tinkerpop.blueprints.oupls.sail.GraphSail;
35
import com.tinkerpop.gremlin.java.GremlinPipeline;
36
import com.tinkerpop.pipes.util.FastNoSuchElementException;
37
import com.tinkerpop.pipes.util.structures.Table;
38

    
39
public class EEA_BDC_Client extends AggregateChecklistClient<TinkerPopClient> {
40

    
41
    /**
42
     *
43
     */
44
    public static final String ID = "eea_bdc";
45
    public static final String LABEL = "European Environment Agency (EEA) Biodiversity data centre (BDC)";
46
    public static final String DOC_URL = "http://semantic.eea.europa.eu/documentation";
47
    public static final String COPYRIGHT_URL = "http://www.eea.europa.eu/legal/eea-data-policy";
48

    
49
    private static final String SPECIES_RDF_FILE_URL = "http://localhost/download/species.rdf.gz"; // http://eunis.eea.europa.eu/rdf/species.rdf.gz
50
    private static final String TAXONOMY_RDF_FILE_URL = "http://localhost/download/taxonomy.rdf.gz"; // http://eunis.eea.europa.eu/rdf/taxonomy.rdf.gz
51
    private static final String LEGALREFS_RDF_FILE_URL = "http://localhost/download/legalrefs.rdf.gz"; // http://eunis.eea.europa.eu/rdf/legalrefs.rdf.gz
52
    private static final String REFERENCES_RDF_FILE_URL = "http://localhost/download/references.rdf.gz"; // http://eunis.eea.europa.eu/rdf/references.rdf.gz
53

    
54
    private static final boolean REFRESH_TDB = false;
55

    
56
    public static final EnumSet<SearchMode> SEARCH_MODES = EnumSet.of(
57
            SearchMode.scientificNameExact,
58
            SearchMode.scientificNameLike,
59
            SearchMode.vernacularNameExact,
60
            SearchMode.vernacularNameLike,
61
            SearchMode.findByIdentifier);
62

    
63
    public static enum RdfSchema {
64

    
65
        /*
66
         *     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
67
    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
68
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
69
    xmlns:dcterms="http://purl.org/dc/terms/"
70
    xmlns:dc="http://purl.org/dc/elements/1.1/"
71
    xmlns:dwc="http://rs.tdwg.org/dwc/terms/"
72
    xmlns:owl="http://www.w3.org/2002/07/owl#"
73
    xmlns="http://eunis.eea.europa.eu/rdf/species-schema.rdf#"
74
    xmlns:sioc="http://rdfs.org/sioc/ns#"
75
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
76
    xmlns:bibo="http://purl.org/ontology/bibo/"
77
    xmlns:cc="http://creativecommons.org/ns#"
78
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
79
         */
80
        EUNIS_SPECIES("es","http://eunis.eea.europa.eu/rdf/species-schema.rdf#"),
81
        EUNIS_TAXONOMY("et", "http://eunis.eea.europa.eu/rdf/taxonomies-schema.rdf#"),
82
        DWC("dwc", "http://rs.tdwg.org/dwc/terms/"),
83
        RDF("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
84
        RDFS("rdfs", "http://www.w3.org/2000/01/rdf-schema#"),
85
        SKOS_CORE("scos_core", "http://www.w3.org/2004/02/skos/core#"),
86
        DC("dc", "http://purl.org/dc/terms/source"),
87
        DCTERMS("dcterms", "http://purl.org/dc/terms/");
88

    
89
        private String schemaUri;
90
        private String abbreviation;
91
        RdfSchema(String abbreviation, String schemaUri) {
92
            this.abbreviation = abbreviation;
93
            this.schemaUri = schemaUri;
94
        }
95

    
96
        public String schemaUri() {
97

    
98
            return schemaUri;
99
        }
100

    
101
        public String abbreviation() {
102

    
103
            return abbreviation;
104
        }
105

    
106
        public String property(String name) {
107
            return schemaUri + name;
108
        }
109

    
110
    }
111

    
112
    public enum SubCheckListId {
113

    
114
        eunis, natura_2000;
115
    }
116

    
117
    private enum RankLevel{
118

    
119
        Kingdom, Phylum, Clazz, Order, Family, Genus;
120
    }
121

    
122
    public EEA_BDC_Client() {
123

    
124
        super();
125
    }
126

    
127
    public EEA_BDC_Client(String checklistInfoJson) throws DRFChecklistException {
128

    
129
        super(checklistInfoJson);
130
    }
131

    
132
    @Override
133
    public void initQueryClient() {
134

    
135
            Neo4jStore neo4jStore;
136
            try {
137
                neo4jStore = new Neo4jStore();
138
            } catch (Exception e1) {
139
                throw new RuntimeException("Creation of Neo4jStore failed",  e1);
140
            }
141
            if(REFRESH_TDB) {
142
                updateStore(neo4jStore);
143
            }
144
            queryClient = new TinkerPopClient(neo4jStore);
145
    }
146

    
147
    /**
148
     * @param neo4jStore
149
     */
150
    private void updateStore(Store neo4jStore) {
151
        try {
152
            neo4jStore.loadIntoStore(
153
//                    SPECIES_RDF_FILE_URL,
154
                    TAXONOMY_RDF_FILE_URL
155
//                    LEGALREFS_RDF_FILE_URL,
156
//                    REFERENCES_RDF_FILE_URL
157
                    );
158
        } catch (Exception e) {
159
            throw new RuntimeException("Loading "
160
                    + SPECIES_RDF_FILE_URL + ", "
161
                    + TAXONOMY_RDF_FILE_URL + ", "
162
                    + LEGALREFS_RDF_FILE_URL + ", "
163
                    + REFERENCES_RDF_FILE_URL +
164
                    " into Neo4jStore failed",  e);
165
        }
166
    }
167

    
168
    @Override
169
    public ServiceProviderInfo buildServiceProviderInfo() {
170

    
171
        ServiceProviderInfo checklistInfo = new ServiceProviderInfo(ID, LABEL, DOC_URL, COPYRIGHT_URL, getSearchModes());
172
        checklistInfo.addSubChecklist(new ServiceProviderInfo(SubCheckListId.eunis.name(), "EUNIS",
173
                "http://www.eea.europa.eu/themes/biodiversity/eunis/eunis-db#tab-metadata",
174
                "http://www.eea.europa.eu/legal/copyright", SEARCH_MODES));
175
        return checklistInfo;
176
    }
177

    
178

    
179
    /**
180
     * @param queryString
181
     * @throws DRFChecklistException
182
     */
183
    private void addPrexfixes(StringBuilder queryString) throws DRFChecklistException {
184

    
185
        for(RdfSchema schema : RdfSchema.values()) {
186
            queryString.append(String.format("PREFIX %s: <%s>\n", schema.abbreviation(), schema.schemaUri()));
187
        }
188
    }
189

    
190
    /**
191
     * @param checklistInfo
192
     * @return
193
     * @throws DRFChecklistException
194
     */
195
    private StringBuilder prepareQueryString() throws DRFChecklistException {
196

    
197
        StringBuilder queryString = new StringBuilder();
198
        addPrexfixes(queryString);
199
        return queryString;
200
    }
201

    
202
    private Taxon createTaxon(Vertex v) {
203

    
204
        Taxon taxon = new Taxon();
205

    
206
        TaxonName taxonName = createTaxonName(v);
207

    
208
        // Taxon
209
        taxon.setTaxonName(taxonName);
210
        taxon.setIdentifier(v.getId().toString());
211
        taxon.setAccordingTo(queryClient.relatedVertexValue(v, RdfSchema.DWC, "nameAccordingToID"));
212
        URI typeUri = queryClient.vertexURI(v, RdfSchema.RDF, "type");
213
        taxon.setTaxonomicStatus(typeUri.getFragment());
214

    
215
        createSources(v, taxon);
216

    
217
        // classification
218
        Classification c = null;
219
        Vertex parentV= null;
220
        try {
221
            parentV = queryClient.relatedVertex(v, RdfSchema.EUNIS_SPECIES, "taxonomy");
222
        } catch (Exception e) {
223
            logger.error("No taxonomy information for " + v.toString());
224
        }
225

    
226
        while (parentV != null) {
227
            logger.debug("parent taxon: " + parentV.toString());
228
            String level = queryClient.relatedVertexValue(parentV, RdfSchema.EUNIS_TAXONOMY, "level");
229
            String parentTaxonName = queryClient.relatedVertexValue(parentV, RdfSchema.EUNIS_TAXONOMY, "name");
230

    
231
            RankLevel rankLevel = null;
232
            try {
233
                rankLevel = RankLevel.valueOf(level);
234
            } catch (Exception e) {
235
                // IGNORE
236
            }
237
            if(rankLevel != null) {
238
                if(c == null) {
239
                 c = new Classification();
240
                }
241
                switch(rankLevel) {
242
                case Clazz:
243
                    c.setClazz(parentTaxonName);
244
                    break;
245
                case Family:
246
                    c.setFamily(parentTaxonName);
247
                    break;
248
                case Genus:
249
                    c.setGenus(parentTaxonName);
250
                    break;
251
                case Kingdom:
252
                    c.setKingdom(parentTaxonName);
253
                    break;
254
                case Order:
255
                    c.setOrder(parentTaxonName);
256
                    break;
257
                case Phylum:
258
                    c.setPhylum(parentTaxonName);
259
                    break;
260
                default:
261
                    break;
262
                }
263
            }
264
            Vertex lastParentV = parentV;
265
            parentV = queryClient.relatedVertex(parentV, RdfSchema.EUNIS_TAXONOMY, "parent");
266
            if(lastParentV.equals(parentV)) {
267
                // avoid endless looping when data is not correct
268
                break;
269
            }
270
        }
271
        if(c != null) {
272
            taxon.setClassification(c);
273
        }
274
        return taxon;
275
    }
276

    
277
    /**
278
     * @param model
279
     * @param taxonR
280
     * @param taxonBase
281
     */
282
    private void createSources(Vertex v, TaxonBase taxonBase) {
283

    
284
        // Sources are source references, re there others like data bases?
285

    
286
        GremlinPipeline<Graph, Vertex> taxonPipe = new GremlinPipeline<Graph, Vertex>(v);
287

    
288
        try {
289
            List<Vertex> titleVs = taxonPipe
290
                    .outE(RdfSchema.EUNIS_SPECIES.property("hasLegalReference")).inV()
291
                    .outE(RdfSchema.DCTERMS.property("source")).inV().dedup()
292
                    .outE(RdfSchema.DCTERMS.property("title")).inV()
293
                    .toList();
294
            for(Vertex tv : titleVs) {
295
                Source source = new Source();
296
                logger.error(tv.toString());
297
                source.setName(tv.getProperty(GraphSail.VALUE).toString());
298
                taxonBase.getSources().add(source);
299
            }
300
        } catch (FastNoSuchElementException e) {
301
            logger.debug("No sources found");
302
        }
303
    }
304

    
305
    /**
306
     * @param taxonR
307
     * @return
308
     */
309
    private TaxonName createTaxonName(Vertex v) {
310

    
311
        TaxonName taxonName = new TaxonName();
312
        // TaxonName
313
        taxonName.setFullName(queryClient.relatedVertexValue(v, RdfSchema.RDFS, "label"));
314
        taxonName.setCanonicalName(queryClient.relatedVertexValue(v, RdfSchema.EUNIS_SPECIES, "binomialName"));
315
        taxonName.setRank(queryClient.relatedVertexValue(v, RdfSchema.EUNIS_SPECIES, "taxonomicRank"));
316
        return taxonName;
317
    }
318

    
319

    
320
    private void createSynonyms(Vertex taxonV, Response tnrResponse) {
321

    
322

    
323
        GremlinPipeline<Graph, Vertex> taxonPipe = new GremlinPipeline<Graph, Vertex>(taxonV);
324

    
325
        try {
326
            List<Vertex> synonymVs = taxonPipe
327
                    .inE(RdfSchema.EUNIS_SPECIES.property("eunisPrimaryName")).outV().dedup()
328
                    .toList();
329
            for(Vertex synonymV : synonymVs) {
330
                String typeUri = queryClient.relatedVertexValue(synonymV, RdfSchema.RDF, "type");
331
                String status = null;
332
                try {
333
                    status = URI.create(typeUri).getFragment();
334
                } catch (Exception e) {
335

    
336
                }
337

    
338
                if (status != null && status.equals("SpeciesSynonym")) {
339

    
340
                    Synonym synonym = new Synonym();
341

    
342
                    TaxonName taxonName = createTaxonName(synonymV);
343
                    synonym.setTaxonomicStatus(status);
344
                    synonym.setTaxonName(taxonName);
345
                    synonym.setAccordingTo(queryClient.relatedVertexValue(synonymV, RdfSchema.DWC, "nameAccordingToID"));
346

    
347
                    createSources(synonymV, synonym);
348

    
349
                    tnrResponse.getSynonym().add(synonym);
350
                }
351
            }
352
        } catch (FastNoSuchElementException e) {
353
            logger.debug("No sources found");
354
        }
355

    
356
    }
357

    
358
    @Override
359
    public void resolveScientificNamesExact(TnrMsg tnrMsg) throws DRFChecklistException {
360

    
361
        for (ServiceProviderInfo checklistInfo : getServiceProviderInfo().getSubChecklists()) {
362

    
363
            // FIXME query specific subchecklist
364

    
365
            // selecting one request as representative, only
366
            // the search mode and addSynonmy flag are important
367
            // for the further usage of the request object
368
            Query query = singleQueryFrom(tnrMsg);
369

    
370
            String queryString = query.getRequest().getQueryString();
371
            logger.debug("original queryString: "+ queryString);
372
            queryString = QueryParser.escape(queryString);
373
            queryString = queryString.replace(" ", "\\ ");
374
            if(query.getRequest().getSearchMode().equals(SearchMode.scientificNameLike.name())) {
375
                queryString += "*";
376
            }
377
            logger.debug("prepared queryString: "+ queryString);
378

    
379
            GremlinPipeline<Graph, Vertex> pipe = null;
380

    
381
            Profiler profiler = Profiler.newCpuProfiler(false);
382

    
383
            logger.debug("Neo4jINDEX");
384

    
385
            ArrayList<Vertex> hitVs = queryClient.vertexIndexQuery("value:" + queryString);
386
            pipe = new GremlinPipeline<Graph, Vertex>(hitVs);
387

    
388
            List<Vertex> vertices = new ArrayList<Vertex>();
389
            pipe.in(RdfSchema.EUNIS_SPECIES.property("binomialName")).fill(vertices);
390

    
391
            updateQueriesWithResponse(vertices, null, null, checklistInfo, query);
392
            profiler.end(System.err);
393
        }
394
    }
395

    
396
    @Override
397
    public void resolveScientificNamesLike(TnrMsg tnrMsg) throws DRFChecklistException {
398
        // delegate to resolveScientificNamesExact,
399
        resolveScientificNamesExact(tnrMsg);
400

    
401
    }
402

    
403
    @Override
404
    public void resolveVernacularNamesExact(TnrMsg tnrMsg) throws DRFChecklistException {
405
        List<Query> queryList = tnrMsg.getQuery();
406

    
407
        for (ServiceProviderInfo checklistInfo : getServiceProviderInfo().getSubChecklists()) {
408

    
409
            // FIXME query specific subchecklist
410

    
411
            // selecting one request as representative, only
412
            // the search mode and addSynonmy flag are important
413
            // for the further usage of the request object
414
            Query query = singleQueryFrom(tnrMsg);
415

    
416
            String queryString = query.getRequest().getQueryString();
417
            logger.debug("original queryString: "+ queryString);
418
            queryString = QueryParser.escape(queryString);
419
            queryString = queryString.replace(" ", "\\ ");
420
            if(query.getRequest().getSearchMode().equals(SearchMode.vernacularNameLike.name())) {
421
                queryString = "*" + queryString + "*";
422
            }
423

    
424
            logger.debug("prepared queryString: "+ queryString);
425

    
426
            GremlinPipeline<Graph, Vertex> pipe = null;
427

    
428
            Profiler profiler = Profiler.newCpuProfiler(false);
429

    
430
            // by using the Neo4j index directly it is possible to
431
            // take full advantage of the underlying Lucene search engine
432
            ArrayList<Vertex> hitVs = queryClient.vertexIndexQuery("value:" + queryString);
433

    
434
//            List<String> matchingNames = new ArrayList<String>(hitVs.size());
435
//            for(Vertex v : hitVs) {
436
//                String matchValue = v.getProperty(GraphSail.VALUE).toString();
437
//                matchingNames.add(matchValue);
438
//                logger.debug("matchingName  " + matchValue);
439
//            }
440

    
441
            List<Vertex> vertices = new ArrayList<Vertex>();
442
            pipe = new GremlinPipeline<Graph, Vertex>(hitVs);
443
            Table table = new Table();
444
            pipe.as("match").in(RdfSchema.DWC.property("vernacularName")).as("taxon").table(table).iterate();
445

    
446
            updateQueriesWithResponse(
447
                    table.getColumn("taxon"), table.getColumn("match"),
448
                    NameType.VERNACULAR_NAME, checklistInfo, query);
449
            profiler.end(System.err);
450
        }
451
    }
452

    
453
    @Override
454
    public void resolveVernacularNamesLike(TnrMsg tnrMsg) throws DRFChecklistException {
455
        resolveVernacularNamesExact(tnrMsg);
456
    }
457

    
458
    @Override
459
    public void findByIdentifier(TnrMsg tnrMsg) throws DRFChecklistException {
460

    
461
        for (ServiceProviderInfo checklistInfo : getServiceProviderInfo().getSubChecklists()) {
462

    
463
            // FIXME query specific subchecklist
464
            Query query = singleQueryFrom(tnrMsg);
465
            String queryString = query.getRequest().getQueryString();
466

    
467
            // by using the Neo4j index directly it is possible to
468
            // take full advantage of the underlying Lucene search engine
469
            queryString = QueryParser.escape(queryString);
470
            ArrayList<Vertex> hitVs = queryClient.vertexIndexQuery("value:" + queryString);
471
            if(hitVs.size() > 0) {
472
                Response response = tnrResponseFromResource(hitVs.get(0), query.getRequest(), null, null);
473
                query.getResponse().add(response);
474
            } else if(hitVs.size() > 1) {
475
                throw new DRFChecklistException("More than one node with the id '" + queryString + "' found");
476
            }
477
        }
478
    }
479

    
480
    private void updateQueriesWithResponse(List<Vertex> taxonNodes, List<Vertex> matchNodes, NameType matchType, ServiceProviderInfo ci, Query query){
481

    
482
        if (taxonNodes == null) {
483
            return;
484
        }
485

    
486
        logger.debug("matching taxon nodes:");
487
        int i = -1;
488
        for (Vertex v : taxonNodes) {
489
            i++;
490
            logger.debug("  " + v.toString());
491
            printPropertyKeys(v, System.err);
492
            if(v.getProperty("kind").equals("url")) {
493
                logger.error("vertex of type 'url' expected, but was " + v.getProperty("type").equals("url"));
494
                continue;
495
            }
496
            Vertex matchNode = null;
497
            if(matchNodes != null) {
498
                matchNode = matchNodes.get(i);
499
            }
500
            Response tnrResponse = tnrResponseFromResource(v, query.getRequest(), matchNode, matchType);
501
            if(tnrResponse != null) {
502
                query.getResponse().add(tnrResponse);
503
            }
504
        }
505
    }
506

    
507
    /**
508
     * @param model
509
     * @param taxonR
510
     * @param request
511
     * @param matchType
512
     * @param matchNode
513
     * @return
514
     */
515
    private Response tnrResponseFromResource(Vertex taxonV, Request request, Vertex matchNode, NameType matchType) {
516

    
517
        Response tnrResponse = TnrMsgUtils.tnrResponseFor(getServiceProviderInfo());
518

    
519
        GremlinPipeline<Graph, Vertex> pipe = new GremlinPipeline<Graph, Vertex>(taxonV);
520

    
521
        String validName = queryClient.relatedVertexValue(taxonV, RdfSchema.EUNIS_SPECIES, "validName");
522

    
523
        boolean isAccepted = validName != null && validName.equals("true");
524

    
525
        logger.debug("processing " + (isAccepted ? "accepted taxon" : "synonym or other")  + " " + taxonV.getId());
526

    
527
        //
528
        if(matchNode != null) {
529
            String matchingName = matchNode.getProperty(GraphSail.VALUE).toString();
530
            tnrResponse.setMatchingNameString(matchingName);
531
            tnrResponse.setMatchingNameType(matchType);
532
        }
533

    
534
        // case when accepted name
535
        if(isAccepted) {
536
            Taxon taxon = createTaxon(taxonV);
537
            tnrResponse.setTaxon(taxon);
538
            if(matchNode == null) {
539
                tnrResponse.setMatchingNameType(NameType.TAXON);
540
                String matchingName = taxon.getTaxonName().getCanonicalName();
541
                tnrResponse.setMatchingNameString(matchingName);
542
            }
543

    
544
        }
545
        else {
546
            // case when synonym
547
            Vertex synonymV = taxonV;
548
            taxonV = null;
549
            try {
550
                taxonV = queryClient.relatedVertex(synonymV, RdfSchema.EUNIS_SPECIES, "eunisPrimaryName");
551
            } catch(Exception e) {
552
                logger.error("No accepted taxon found for " + synonymV.toString() + " (" + synonymV.getProperty(GraphSail.VALUE) + ")");
553
            }
554

    
555
            if(taxonV != null) {
556
                Taxon taxon = createTaxon(taxonV);
557
                tnrResponse.setTaxon(taxon);
558
            } else {
559
            }
560
            if(matchNode == null) {
561
                tnrResponse.setMatchingNameType(NameType.SYNONYM);
562
                String matchingName = queryClient.relatedVertexValue(synonymV, RdfSchema.EUNIS_SPECIES, "binomialName");
563
                tnrResponse.setMatchingNameString(matchingName);
564
            }
565
        }
566

    
567
        if(request.isAddSynonymy()) {
568
            createSynonyms(taxonV, tnrResponse);
569
        }
570

    
571
        logger.debug("processing " + (isAccepted ? "accepted taxon" : "synonym or other")  + " " + taxonV.getId() + " DONE");
572
        return tnrResponse;
573
    }
574

    
575
    /**
576
     * @param vertex
577
     */
578
    private void printEdges(Neo4j2Vertex vertex) {
579
        Iterable<Relationship> rels = vertex.getRawVertex().getRelationships();
580
        Iterator<Relationship> iterator = rels.iterator();
581
        if(iterator.hasNext()) {
582
            Relationship rel = iterator.next();
583
            System.err.println(rel.toString() + ": " + rel.getStartNode().toString() + "-[" +  rel.getType() + "]-" + rel.getEndNode().toString());
584
        }
585
    }
586

    
587
    private void printPropertyKeys(Vertex v, PrintStream ps) {
588
        StringBuilder out = new StringBuilder();
589
        out.append(v.toString());
590
        for(String key : v.getPropertyKeys()) {
591
            out.append(key).append(": ").append(v.getProperty(key)).append(" ");
592
        }
593
        ps.println(out.toString());
594
    }
595

    
596
    @Override
597
    public EnumSet<SearchMode> getSearchModes() {
598
        return SEARCH_MODES;
599
    }
600

    
601
    @Override
602
    public boolean isSupportedIdentifier(String value) {
603
        return IdentifierUtils.checkURI(value);
604
    }
605

    
606
}
(5-5/12)