public CachedGraphWrapper getGraphWrapper () { return CachedGraphWrapper.getInstance ( this.getGraph () ); } }
@Override public DataSource map ( S source, ONDEXGraph graph ) { return CachedGraphWrapper .getInstance ( graph ) .getDataSource ( this.getValue () ); } }
@Override public EvidenceType map ( S source, ONDEXGraph graph ) { return CachedGraphWrapper .getInstance ( graph ) .getEvidenceType ( this.getValue () ); } }
@Override public ConceptClass map ( S source, ONDEXGraph graph ) { return CachedGraphWrapper.getInstance ( graph ).getConceptClass ( this.getValue () ); }
@Override public ConceptAccession map ( S source, ONDEXConcept concept, ONDEXGraph graph ) { return CachedGraphWrapper .getInstance ( graph ) .getAccession ( this.getValue (), concept ); } }
@Override public ConceptClass map ( S src, ONDEXGraph graph ) { String id = this.getIdMapper ().map ( src ); String fullName = Optional.ofNullable ( this.getFullNameMapper () ).map ( m -> m.map ( src, graph ) ).orElse ( "" ); String description = Optional.ofNullable ( this.getDescriptionMapper () ).map ( m -> m.map ( src, graph ) ).orElse ( "" ); ConceptClass parent = Optional.ofNullable ( this.getParentMapper () ).map ( m -> m.map ( src, graph ) ).orElse ( null ); ConceptClass cc = CachedGraphWrapper.getInstance ( graph ).getConceptClass ( id, fullName, description, parent ); return cc; }
@Override public ConceptAccession map ( S src, ONDEXConcept concept, ONDEXGraph graph ) { String accession = this.getAccessionValueMapper ().map ( src, graph ); if ( accession == null ) return null; DataSource dataSrc = Optional.ofNullable ( this.getDataSourceMapper () ) .map ( m -> m.map ( src, graph ) ) .orElseThrow ( () -> new NullPointerException ( this.getClass ().getName () + " needs a data source mapper" ) ); boolean isAmbiguous = Optional.ofNullable ( this.getAmbiguityMapper () ) .map ( m -> m.map ( src, graph ) ) .map ( Boolean.TRUE::equals ) .orElseThrow ( () -> new NullPointerException ( this.getClass ().getName () + " needs an ambiguity mapper" ) ); return CachedGraphWrapper.getInstance ( graph ).getAccession ( accession, dataSrc, isAmbiguous, concept ); }
@Override public ONDEXConcept map ( S src, ConceptClass conceptClass, ONDEXGraph graph ) { CachedGraphWrapper graphw = CachedGraphWrapper.getInstance ( graph ); String id = this.getIdMapper ().map ( src, graph ); String descr = Optional.ofNullable ( this.getDescriptionMapper () ).map ( m -> m.map ( src, graph ) ).orElse ( "" ); String ann = Optional.ofNullable ( this.getAnnotationMapper () ).map ( m -> m.map ( src, graph ) ).orElse ( "" ); EvidenceType evidence = this.getEvidenceMapper ().map ( src, graph ); DataSource dataSrc = this.getDataSourceMapper ().map ( src, graph ); ONDEXConcept result = graphw.getConcept ( id, ann, descr, dataSrc, conceptClass, evidence ); if ( this.isVisited ( src ) ) return result; Optional .ofNullable ( this.getPreferredNameMapper () ) // if available, .map ( mapper -> mapper.map ( src, graph ) ) // get a value from it .ifPresent ( prefName -> result.createConceptName ( prefName, true ) ); // and use it to build a new name, if it's non-null // Same approach for names mapper, but this has multiple results. Optional.ofNullable ( this.getAltNamesMapper () ) .map ( mapper -> mapper.map ( src, graph ) ) .ifPresent ( names -> names.filter ( name -> name != null ) .forEach ( name -> result.createConceptName ( name, false ) ) ); Optional.ofNullable ( this.getAccessionsMapper () ) .ifPresent ( mapper -> mapper.map ( src, result, graph ).count () ); return result; }
@Override public ONDEXRelation map ( ONDEXConcept c1, ONDEXConcept c2, ONDEXGraph graph ) { CachedGraphWrapper graphw = CachedGraphWrapper.getInstance ( graph ); RelationType relType = graphw.getRelationType ( this.getRelationTypePrototype () ); EvidenceType evidenceType = graphw.getEvidenceType ( this.getEvidenceTypePrototype () ); return graphw.getRelation ( c1, c2, relType, evidenceType ); }