@Override public boolean inheritedFrom(AttributeName attributeName) { AttributeName attrname = getOfType(); while (!attrname.equals(attributeName)) { attrname = attrname.getSpecialisationOf(); if (attrname == null) { return false; } } return true; }
/** * Generate metadata for Attribute Name. * @param attr * An AttributeName (from the Ondex API). * @return JSONObject * JSONObject containing information about the Attribute. */ private JSONObject buildAttributeName(AttributeName attrName) { JSONObject attrNameJson= new JSONObject(); attrNameJson.put(JSONAttributeNames.ID, attrName.getId()); attrNameJson.put(JSONAttributeNames.FULLNAME, attrName.getFullname()); // Attribute Unit (optional). Unit attrUnit= attrName.getUnit(); if(attrUnit != null) { attrNameJson.put(JSONAttributeNames.UNIT, buildUnit(attrUnit)); } attrNameJson.put(JSONAttributeNames.DATATYPE, attrName.getDataTypeAsString()); attrNameJson.put(JSONAttributeNames.DESCRIPTION, attrName.getDescription()); // Attribute SpecialisationOf (optional). AttributeName spec= attrName.getSpecialisationOf(); if(spec != null) { attrNameJson.put(JSONAttributeNames.SPECIALISATIONOF, buildAttributeName(spec)); } return attrNameJson; }
className = an.getDataTypeAsString(); selectedUnit = an.getUnit(); selectedAn = an.getSpecialisationOf();
attNew = ondexMetaData.createAttributeName(name, att.getFullname(), att.getDescription(), att.getUnit(), att.getDataType(), att.getSpecialisationOf()); return attNew;
/** * Cast a given AttributeName into a BerkeleyAttributeName. * * @param old * AttributeName * @return BerkeleyAttributeName */ protected static BerkeleyAttributeName convert(AttributeName old) { BerkeleyAttributeName nu = new BerkeleyAttributeName(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getUnit(), old.getDataTypeAsString(), old.getSpecialisationOf()); return nu; }
/** * @param attNames * @param omd * copy from MetaData * @param nomd * copy to MetaData */ private void copyAttributeNames(Iterable<AttributeName> attNames, ONDEXGraphMetaData omd, ONDEXGraphMetaData nomd) { // "specializations_of"s that occur before there specialisation HashSet<AttributeName> atDependencyNotResolved = new HashSet<AttributeName>(); for (AttributeName att : attNames) { AttributeName spec = att.getSpecialisationOf(); AttributeName newSpec = null; if (spec != null) { newSpec = nomd.getAttributeName(spec.getId()); if (newSpec == null) { atDependencyNotResolved.add(att); continue; } } if (!nomd.checkAttributeName(att.getId())) nomd.createAttributeName(att.getId(), att.getFullname(), att .getDescription(), att.getUnit(), att.getDataType(), newSpec); } if (atDependencyNotResolved.size() > 0) { copyAttributeNames(atDependencyNotResolved, omd, nomd); } }
AttributeName parent = aname.getSpecialisationOf ();
an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;
an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;
Property aN = model.createProperty(ONDEXRdf.attributeNameToUri(graphURI, an)); rdfMetadata(aN, an); if (an.getSpecialisationOf() != null) aN.addProperty(RDFS.subPropertyOf, model.createProperty(ONDEXRdf.attributeNameToUri(graphURI, an.getSpecialisationOf())));
AttributeName spec = attr.getSpecialisationOf(); if (spec != null) { xmlw.writeStartElement(XMLTagNames.SPECIALISATIONOF);