/** * 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; }
if(rt.getFullname().equals("")) { relType= rt.getId(); relType= rt.getFullname();
/** * Returns a JLabel for the relation type */ @Override public Object getElementAt(int index) { JLabel label = null; if (index > -1) { RelationType rt = relationTypes.get(index); String name = rt.getFullname(); if (name.trim().length() == 0) name = rt.getId(); label = new JLabel(name); label.setName(rt.getId()); label.setToolTipText("(" + rt.getId() + ") " + rt.getDescription().replaceAll("\\s+", " ")); } return label; }
public String toString() { return "Transition on " + rt.getId(); } }
/** * Returns edge size for a given RelationType. * * @param rt * RelationType * @return edge size */ public static Integer getSizeForRelationType(RelationType rt) { String key = "RelationType.Size." + rt.getId(); if (visual.getProperty(key) != null) { return Integer.valueOf(visual.getProperty(key)); } else { // maybe parent relation type exist in mapping RelationType parent = rt.getSpecialisationOf(); if (parent != null) { return getSizeForRelationType(parent); } } return defaultEdgeSize; }
ObjectProperty objectProperty = model.createObjectProperty(urlPrefixMetaData + rt.getId()); objectProperty.addComment(rt.getDescription(), "en"); objectProperty.addLabel(rt.getFullname(), "en"); ObjectProperty objectProperty = model.getObjectProperty(urlPrefixMetaData + rt.getId()); RelationType superRt = rt.getSpecialisationOf(); if (superRt != null) { objectProperty.addSuperProperty(model.getObjectProperty(urlPrefixMetaData + superRt.getId())); } else { objectProperty.addSuperProperty(rdfsSuperRelationType);
boolean update = false; RelationType rt = og.getMetaData().getRelationType(nameS); if ((rt.getFullname() == null || rt.getFullname().equals("")) && (fullname != null && fullname.trim().equals(""))) { rt.setFullname(fullname); update = true; if ((rt.getDescription() == null || rt.getDescription().equals( "")) && (descriptionS != null && descriptionS.trim().equals( ""))) { rt.setDescription(descriptionS); update = true; if ((rt.getInverseName() == null || rt.getInverseName().equals( "")) && (inverseNameS != null && inverseNameS.trim().equals( ""))) { rt.setInverseName(inverseNameS); update = true; rt.setAntisymmetric(isAntisymmetric); rt.setReflexive(isReflexive); rt.setSymmetric(isSymmetric); rt.setTransitiv(isTransitive);
@Override public boolean isAssignableFrom(RelationType rt) { RelationType curr = rt; while (!curr.equals(this)) { curr = curr.getSpecialisationOf(); if (curr == null) { return false; } } return true; }
/** * returns the name of the current variable. */ public String getVariableName() { if (variable instanceof AttributeName) return ((AttributeName) variable).getFullname(); else if (variable instanceof ConceptClass) return ((ConceptClass) variable).getFullname(); else if (variable instanceof RelationType) return ((RelationType) variable).getFullname(); else if (variable instanceof String) return (String) variable; else return null; }
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); }
/** * Extracts the label from a given RelationType. * * @param rt * ARelationType * @return String */ private String getLabel(RelationType rt) { String label = null; // first try fullname of rt label = rt.getFullname(); // else take id of rtset if (label.trim().length() == 0) { label = rt.getId(); } label = makeMaxLength(label); return label; }
/** * Returns edge color for a given RelationType. * * @param rt * RelationType * @return Color */ public static Color getColorForRelationType(RelationType rt) { String key = "RelationType.Color." + rt.getId(); if (visual.getProperty(key) != null) { return convertToColor(visual.getProperty(key)); } else { // maybe parent relation type exist in mapping RelationType parent = rt.getSpecialisationOf(); if (parent != null) { return getColorForRelationType(parent); } } return defaultColor; }
new FileOutputStream(new File(workingDir, file)), enc); String title = relation.getOfType().getDescription(); if (title.length() == 0) { title = relation.getOfType().getFullname(); title = relation.getOfType().getId(); + relation.getOfType().getDescription() + ") " + " Attribute Table"); xmlw.writeEndElement(); if (PRETTY)
/** * Returns whether this RelationType is a transitive superclass of * <code>rt</code>. */ @Override public boolean isAssignableFrom(RelationType rt) { RelationType curr = rt; while (!curr.equals(this)) { curr = curr.getSpecialisationOf(); if (curr == null) { return false; } } return true; }
/** * 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; }
/** * 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()); }
/** * Extracts the label from a given edge. * * @param edge * ONDEXRelation * @return String */ private String getLabel(ONDEXRelation edge) { String label; // first try fullname of rt RelationType rt = edge.getOfType(); label = rt.getFullname(); // else take id of rt if (label.trim().length() == 0) { label = rt.getId(); } label = makeMaxLength(label); return label; }
RelationType sp = rt.getSpecialisationOf(); if (sp != null) { String spid = sp.getId(); clause.append(map); clause.append("(X,Y,Z) :- "); String id = rt.getId(); map = makeLower(id); if (rtMapping.containsKey(id))
private boolean instanceOf(RelationType rt, ONDEXRelation r) { RelationType rt_query = r.getOfType(); while (!rt_query.equals(rt)) { if (rt_query.getSpecialisationOf() == null) { return false; } rt_query = rt_query.getSpecialisationOf(); } return true; }