public static void changeRelationDirection(ONDEXGraph graph, String originaRT, String newRT) { ONDEXGraphMetaData meta = graph.getMetaData(); RelationType original = meta.getRelationType(originaRT); String invName = original.getInverseName(); if (invName == null) { invName = newRT; } else { System.err.println("Inverse type found: " + invName); } RelationType inverse = createRT(graph, invName); }
/** * Generate metadata for Relation Type. * @param rt * Relation Type (from the Ondex API). * @return JSONObject * JSONObject containing information about the Relation Type. */ private JSONObject buildRelationType(RelationType rt) { JSONObject rtJson= new JSONObject(); rtJson.put(JSONAttributeNames.ID, rt.getId()); rtJson.put(JSONAttributeNames.FULLNAME, rt.getFullname()); rtJson.put(JSONAttributeNames.INVERSENAME, rt.getInverseName()); rtJson.put(JSONAttributeNames.ISANTISYMMETRIC, String.valueOf(rt.isAntisymmetric())); rtJson.put(JSONAttributeNames.ISREFLEXTIVE, String.valueOf(rt.isReflexive())); rtJson.put(JSONAttributeNames.ISTRANSITIVE, String.valueOf(rt.isTransitiv())); rtJson.put(JSONAttributeNames.ISSYMMETRIC, String.valueOf(rt.isSymmetric())); rtJson.put(JSONAttributeNames.DESCRIPTION, rt.getDescription()); // RelationType SpecialisationOf (optional). RelationType spec= rt.getSpecialisationOf(); if(spec != null) { rtJson.put(JSONAttributeNames.SPECIALISATIONOF, buildRelationType(spec)); } return rtJson; }
description.setText(relationType.getDescription()); if (relationType.getInverseName() != null) inverse.setText(relationType.getInverseName());
update = true; if ((rt.getInverseName() == null || rt.getInverseName().equals( "")) && (inverseNameS != null && inverseNameS.trim().equals(
.getDescription(), rt.getInverseName(), rt .isAntisymmetric(), rt.isReflexive(), rt.isSymmetric(), rt.isTransitiv(), newSpec);
/** * 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; }
xmlw.writeCharacters(rt.getInverseName()); xmlw.writeEndElement();