/** * Return all of the evidence types of the entities * contained in the collection * * @param cs * @return set of evidence types */ public static Set<EvidenceType> getConceptEvidence(Collection<ONDEXEntity> cs) { Set<EvidenceType> result = new HashSet<EvidenceType>(); for (ONDEXEntity c : cs) { result.addAll(c.getEvidence()); } return result; }
/** * Return all of the evidence types of the entities * contained in the collection * * @param cs * @return set of evidence types */ public static Set<EvidenceType> getConceptEvidence(Collection<ONDEXEntity> cs) { Set<EvidenceType> result = new HashSet<EvidenceType>(); for (ONDEXEntity c : cs) { result.addAll(c.getEvidence()); } return result; }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { StringBuilder sb = new StringBuilder(); boolean first = true; for (EvidenceType evidence : cOrr.getEvidence()) { if (!first) sb.append(", "); sb.append(evidence.getId()); first = false; } return sb.toString(); }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { for (EvidenceType et : cOrr.getEvidence()){ if(et.equals(ofEv))return ofEv.getId(); } return ""; }
/** * Adds a weighting to the entity corresponding to the highest weight * evidence * * @param entity the Relation or Concept to add to * @param weightings a map of evidence to weights * @param weightingAtt the weighting attribute */ private void createWeightingsOnEntity(ONDEXEntity entity, Map<EvidenceType, Double> weightings, AttributeName weightingAtt) { Double highestWeighting = null; for (EvidenceType evidence : entity.getEvidence()) { Double weighting = weightings.get(evidence); if (weighting != null) { if (highestWeighting == null || weighting > highestWeighting) { highestWeighting = weighting; } } } if (highestWeighting != null) { if (entity instanceof ONDEXConcept) ((ONDEXConcept) entity).createAttribute(weightingAtt, highestWeighting, false); else if (entity instanceof ONDEXRelation) ((ONDEXRelation) entity).createAttribute(weightingAtt, highestWeighting, false); } }
public void writeEntity(Resource res, ONDEXEntity entity, Model model, String graphURI) { // contexts for(ONDEXConcept ctxt : entity.getTags()) { res.addProperty(model.createProperty(ONDEXRdf.contextUri), model.createResource(ONDEXRdf.conceptToUri(graphURI, ctxt))); } // evidence for(EvidenceType evt : entity.getEvidence()) { res.addProperty(model.createProperty(ONDEXRdf.evidenceUri), model.createResource(ONDEXRdf.etToUri(graphURI, evt))); } // Attribute values for(Attribute attribute : entity.getAttributes()) { // todo: add more handlers Property p = model.createProperty(ONDEXRdf.attributeNameToUri(graphURI, attribute.getOfType())); Object value = attribute.getValue(); if (value instanceof String) res.addProperty(p, (String) value); else if (value instanceof Integer) res.addLiteral(p, (Integer) value); else if (value instanceof Double) res.addLiteral(p, (Double) value); else if (value instanceof Boolean) res.addLiteral(p, (Boolean) value); else if (value instanceof Long) res.addLiteral(p, (Long) value); //else res.addProperty(p, value.toString()); } }