/** * Generate metadata for Attribute. * @param attr * An Attribute (from the Ondex API). * @return JSONObject * JSONObject containing information about the Attribute including its Attribute Name, * Unit(s) & SpecialisationOf. */ private JSONObject buildAttribute(Attribute attr) { JSONObject attrJson= new JSONObject(); attrJson.put(JSONAttributeNames.ATTRIBUTENAME, buildAttributeName(attr.getOfType())); // Attribute value (can be a String or any other data type or an Object or a Java class instance). attrJson.put(JSONAttributeNames.VALUE, attr.getValue().toString()); /** ^^ fix this. */ attrJson.put(JSONAttributeNames.DOINDEX, String.valueOf(attr.isDoIndex())); return attrJson; }
/** * Modify given concept Attribute * * @param attribute * Attribute to modify */ public GDSPopup(Attribute attribute) { this.attribute = attribute; // editor panel BoxLayout layout = new BoxLayout(this, BoxLayout.LINE_AXIS); this.setLayout(layout); // check box for do index box = new JCheckBox("Do index this Attribute?"); box.setSelected(attribute.isDoIndex()); this.add(box); // button to close popup JButton close = new JButton("close"); close.addActionListener(this); this.add(close); }
public static void changeAttributeValue(ONDEXEntity e, AttributeName n, Object value) { if (e instanceof ONDEXConcept) { ONDEXConcept c = (ONDEXConcept) e; boolean doIndex = c.getAttribute(n).isDoIndex(); c.deleteAttribute(n); c.createAttribute(n, value, doIndex); } if (e instanceof ONDEXRelation) { ONDEXRelation r = (ONDEXRelation) e; boolean doIndex = r.getAttribute(n).isDoIndex(); r.deleteAttribute(n); r.createAttribute(n, value, doIndex); } else { throw new IllegalArgumentException( "This method only works with Ondex concepts and relations."); } }
if ( attribute.isDoIndex () )
/** * Determines the type of Attribute data. * * @param data * Attribute * @param clause * StringBuffer */ private void decideCompose(Attribute data, StringBuffer clause) { Object o = data.getValue(); if (o instanceof Number) { composeNumber((Number) o, clause); } else if (o instanceof Boolean) { composeBoolean((Boolean) o, clause); } else if (o instanceof String) { composeString((String) o, clause); } else { composeObject(o, clause); } clause.append(data.isDoIndex()); clause.append(").\n"); }
Attribute attribute = (Attribute) value; value = attribute.getValue(); if (attribute.isDoIndex()) {
/** * Copies all Attribute from old concept to new concept. * * @param oldC * old ONDEXConcept * @param newC * new ONDEXConcept */ private void copyGDS(ONDEXConcept oldC, ONDEXConcept newC) { // iterate over all old Attribute for (Attribute attribute : oldC.getAttributes()) { // clone old Attribute on new concept newC.createAttribute(attribute.getOfType(), attribute.getValue(), attribute.isDoIndex()); } }
Attribute attribute = (Attribute) value; value = attribute.getValue(); if (attribute.isDoIndex()) {
/** * Cast a given Attribute into a BerkeleyConceptAttribute. * * @param old * Attribute * @return BerkeleyConceptAttribute */ protected static BerkeleyConceptAttribute convert(Attribute old) { BerkeleyConceptAttribute nu = new BerkeleyConceptAttribute( old.getSID(), old.getOwnerId(), old.getOfType(), old.getValue(), old.isDoIndex()); return nu; }
/** * Cast a given Attribute into a BerkeleyRelationAttribute. * * @param old * Attribute * @return BerkeleyRelationAttribute */ protected static BerkeleyRelationAttribute convert(Attribute old) { BerkeleyRelationAttribute nu = new BerkeleyRelationAttribute( old.getSID(), old.getOwnerId(), old.getOfType(), old.getValue(), old.isDoIndex()); return nu; }
/** * Creates a gds on concept only if it does not already exists * * @param target * - relation * @param newAttribute * - attribute to create * @throws AccessDeniedException * @throws NullValueException */ public static void addNewAttribute(ONDEXConcept target, Attribute newAttribute) throws NullValueException, AccessDeniedException { if (target.getAttribute(newAttribute.getOfType()) == null) target.createAttribute(newAttribute.getOfType(), newAttribute.getValue(), newAttribute.isDoIndex()); }
/** * Creates a gds on relation only if it does not already exists * * @param target * - relation * @param newAttribute * - attribute to create * @throws AccessDeniedException * @throws NullValueException */ public static void addNewAttribute(ONDEXRelation target, Attribute newAttribute) throws NullValueException, AccessDeniedException { if (target.getAttribute(newAttribute.getOfType()) == null) target.createAttribute(newAttribute.getOfType(), newAttribute.getValue(), newAttribute.isDoIndex()); }
COMMUTILS.assertLiteral ( graphModel, myiri, attrProp, vl ); if ( !attr.isDoIndex () ) continue;
/** * Copies all Attribute from old relation to new relation. * * @param oldR * old ONDEXRelation * @param newR * new ONDEXRelation */ private void copyGDS(ONDEXRelation oldR, ONDEXRelation newR) { // iterate over all old Attribute for (Attribute attribute : oldR.getAttributes()) { // clone old Attribute on new relation only if not yet exists if (newR.getAttribute(attribute.getOfType()) != null) // old Attribute gets overridden newR.deleteAttribute(attribute.getOfType()); else newR.createAttribute(attribute.getOfType(), attribute.getValue(), attribute.isDoIndex()); } } }
rattribute.isDoIndex());
if (nr.getAttribute(rattribute.getOfType()) == null) nr.createAttribute(rattribute.getOfType(), rattribute.getValue(), rattribute.isDoIndex());
source.getAttribute(anOriginal).isDoIndex());
source.getAttribute(anOriginal).isDoIndex());
attribute.getValue(), attribute.isDoIndex());