public String toString() { return "Transition on " + rt.getId(); } }
/** * removes the given relation type from the list of filters. * * @param rt * the relation type to remove. */ public void removeRTFilter(RelationType rt) { rtFilters.remove(rt.getId()); }
/** * adds a relation type filter. * * @param rt * the relation type to filter for. * @return if the operation was allowed. */ public boolean addRTFilter(RelationType rt) { if (variable != null && variable instanceof RelationType) return false; rtFilters.add(rt.getId()); return true; }
/** * Add RelationType restriction valid at any depth in an outgoing direction * (relative to seed) * * @param rts * the relation type set */ public void addOutgoingRelationType(RelationType rts) { if (outgoingRelationTypeValidAtAnyDepth == null) { outgoingRelationTypeValidAtAnyDepth = new HashSet<String>(); } outgoingRelationTypeValidAtAnyDepth.add(rts.getId()); }
/** * Add RelationType restriction valid at any depth in an incoming direction * (relative to seed) * * @param rts * the relation type set */ public void addIncomingRelationType(RelationType rts) { if (incomingRelationTypeValidAtAnyDepth == null) { incomingRelationTypeValidAtAnyDepth = new HashSet<String>(); } incomingRelationTypeValidAtAnyDepth.add(rts.getId()); }
@Override public void setSpecialisationOf(RelationType specialisationOf) { MetaDataHelper.setString(sg, tableName, "specOf", mid, specialisationOf.getId()); }
public static String rtToUri(String graphUri, RelationType rt) { return toUri(graphUri, "relationType", rt.getId()); }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { if(AbstractConcept.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXConcept)cOrr).getOfType().getId(); } if(AbstractRelation.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXRelation)cOrr).getOfType().getId(); } throw new InvalidOndexEntityException(cOrr.getClass()+": is not an Ondex class for which type is known"); }
/** * Loads available RelationTypes into ComboBox. * */ private void initSpecialisationOf() { // get list of available rts Vector<String> relationTypes = new Vector<String>(); relationTypes.add(""); RelationType[] sorted = aog.getMetaData().getRelationTypes().toArray(new RelationType[0]); Arrays.sort(sorted, new CaseInsensitiveMetaDataComparator()); for (RelationType rt : sorted) { relationTypes.add(rt.getId()); } specialisationOf = new JComboBox(relationTypes); }
private String[] getRelationTypeNames() { // only add non-empty relation types Set<RelationType> rts = new HashSet<RelationType>(); for (RelationType rt : graph.getMetaData().getRelationTypes()) { if (graph.getRelationsOfRelationType(rt).size() > 0) { rts.add(rt); } } String[] names = new String[rts.size()]; int i = 0; for (RelationType rt : rts) { names[i] = rt.getId(); i++; } Arrays.sort(names); return names; }
@Override public boolean inheritedFrom(RelationType rt) { try { return soapGraph.inheritedFromRelation(graphId, id, rt.getId()); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } // default return false; }
/** * For a given relation returns the source concept, observes the reverse * logic flag. * * @param r * ONDEXRelation * @return source concept */ private ONDEXConcept getSource(ONDEXRelation r) { String relationType = r.getOfType().getFullname(); if (relationType == null) relationType = r.getOfType().getId(); if (relationTypeReverseLogic.contains(relationType)) { return r.getToConcept(); } return r.getFromConcept(); }
public synchronized ONDEXRelation getRelation ( ONDEXConcept from, ONDEXConcept to, RelationType type, EvidenceType evidence ) { String id = from.getPID () + to.getPID () + type.getId () + evidence.getId (); return this.cacheGet ( ONDEXRelation.class, id, () -> this.graph.getFactory ().createRelation ( from, to, type, evidence ) ); }
@Override protected ONDEXRelation retrieveRelation(ONDEXConcept fromConcept, ONDEXConcept toConcept, RelationType ofType) throws AccessDeniedException { BerkeleyRelationKey id = new BerkeleyRelationKey(sid, fromConcept.getId(), toConcept.getId(), ofType.getId()); byte[] array = berkeley.getFromDatabase(BerkeleyRelation.class, id); if (array != null) { BerkeleyRelation r = BerkeleyRelation.deserialise(berkeley, array); r.setUpdateListener(this); return r; } return null; }
@Override public RelationKey getKey() { long sid = getSID(); int from = getFromConcept().getId(); int to = getToConcept().getId(); String ofType = getOfType().getId(); return new RelationKeyImpl(sid, from, to, ofType); }
/** * Create a RelationType, if missing in metadata. * * @param name - Name of RelationType to be contained * @return RelationType */ private RelationType getRelationType(String name) { RelationType rt = aog.getMetaData().getRelationType(name); if (rt != null) { return aog.getMetaData().getFactory().createRelationType(rt.getId(),rt); } else { Parser.propagateEventOccurred( new RelationTypeMissingEvent("Missing RelationType: "+name, "getRelationType(String name)")); } return null; }
@Override public void setSpecialisationOf(RelationType specialisationOf) { try { JAXBElement<String> old = soapGraph.getRelationType(graphId, id) .getSpecialisationOf(); old.setValue(specialisationOf.getId()); soapGraph.getRelationType(graphId, id).setSpecialisationOf(old); } catch (WebserviceException_Exception e) { parent.fireActionEvent(e, e.getMessage()); e.printStackTrace(); } }
/** * Cast a given RelationType into a BerkeleyRelationType. * * @param old * RelationType * @return BerkeleyRelationType */ protected static BerkeleyRelationType convert(RelationType old) { BerkeleyRelationType nu = new BerkeleyRelationType(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getInverseName(), old.isAntisymmetric(), old.isReflexive(), old.isSymmetric(), old.isTransitiv(), old.getSpecialisationOf()); return nu; }
public Model createModel(ONDEXGraph og) { Model instanceModel = ModelFactory.createDefaultModel(); for (ONDEXConcept concept : og.getConcepts()) { Resource classOfConcept = instanceModel.createResource(urlPrefixMetaData + concept.getOfType().getId()); instanceModel.createResource(urlPrefixInstances + concept.getId(), classOfConcept); } for (ONDEXRelation or : og.getRelations()) { Property propertyOfPredicate = instanceModel.createProperty(urlPrefixMetaData, or.getOfType().getId()); Resource fromConcept = instanceModel.getResource(urlPrefixInstances + or.getFromConcept().getId()); Resource toConcept = instanceModel.getResource(urlPrefixInstances + or.getToConcept().getId()); instanceModel.createStatement(toConcept, propertyOfPredicate, fromConcept); } return instanceModel; }