/** * Extracts all attribute names corresponding to GDSs with * <code>Double</code> values, that can be used as edge weights. * * @return an array of attribute name IDs. */ private String[] getAttributeNames() { Vector<String> v = new Vector<String>(); v.add(defVal); for (AttributeName a : graph.getMetaData().getAttributeNames()) { if (Number.class.isAssignableFrom(a.getDataType()) && !AppearanceSynchronizer.attr.contains(a.getId())) v.add(a.getId()); } return v.toArray(new String[v.size()]); }
String getAttributeName() { if (an.getFullname() != null) return an.getFullname(); else return an.getId(); }
/** * 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; }
/** * Returns a JLabel for the attribute name */ @Override public Object getElementAt(int index) { JLabel label = null; if (attributeNames.size() == 0 && index == 0) { label = new JLabel("no attributes present!"); } else if (index > -1) { AttributeName an = attributeNames.get(index); String name = an.getFullname(); if (name.trim().length() == 0) name = an.getId(); label = new JLabel(name); label.setName(an.getId()); label.setToolTipText("(" + an.getId() + ") " + an.getDescription()); } return label; }
@Override public String getHeaderName() { return "Attribute:" + an.getId(); }
/** * @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); } }
int counter = 1; while (target.getAttribute(an) != null) { String id = anOriginal.getId() + ":" + counter; an = meta.getAttributeName(id); if (an == null) { an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;
getAttribute.setInt(2, id); getAttribute.setString(3, "concept"); getAttribute.setString(4, attrname.getId()); String an = attrname.getDataTypeAsString();
&& !excludeGDSSet.contains(attribute.getOfType().getId())) { xmlw.writeStartElement(tag); .map ( a -> String.format ( "%s (\"%s\", T[%s/%s])", a.getId (), a.getFullname (), a.getDataTypeAsString (), Optional.of ( a.getDataType () ).map ( Object::toString ).orElse ( "<null>" )
public void checkAttributeNameisNumerical() throws IncorrectAttributeValueType { if (!Number.class.isAssignableFrom(att.getDataType())) { throw new IncorrectAttributeValueType(att.getDataType() + " is not a type of number and therefore can not be used to rank paths"); } }
aname.getId () + Optional.ofNullable ( aname.getUnit () ).map ( u -> u.getId () ).orElse ( "" ) + ObjectUtils.defaultIfNull ( aname.getDataTypeAsString (), "_" )
AttributeName parent = aname.getSpecialisationOf (); COMMUTILS.assertResource ( graphModel, myiri, iri ( "rdfs:subPropertyOf" ), parentIri ); String dataTypeIri = Optional.ofNullable ( aname.getDataType () ) .map ( clazz -> XsdMapper.dataTypeIri ( clazz ) ) .orElse ( null );
if (!(attrName.getDataType().isAssignableFrom(value .getClass()))) { this.errorMessages + attrName.toString() + ".\nShould be " + attrName.getDataTypeAsString() + " but found " + value.getClass() if (attrName.getDataType().isAssignableFrom( String.class)) { value = value.toString(); else if (attrName.getDataType().isAssignableFrom( Double.class)) { try { else if (attrName.getDataType().isAssignableFrom( Integer.class)) { try { else if (attrName.getDataType().isAssignableFrom( Float.class)) { try { this.errorMessages .add("No conversion possible. Trying to cast object."); value = attrName.getDataType().cast(value);
/** * Constructor sets Attribute. * * @param attribute * Attribute */ public GDSTableModel(Attribute attribute) { if (attribute != null) { this.attribute = attribute; this.dataType = attribute.getOfType().getDataTypeAsString(); } }
@Override public boolean inheritedFrom(AttributeName attributeName) { AttributeName attrname = getOfType(); while (!attrname.equals(attributeName)) { attrname = attrname.getSpecialisationOf(); if (attrname == 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; }
String attId = att.getId(); int i = 0; int index = attId.lastIndexOf('_'); if (index > -1) { String id = att.getId(); attId = id.substring(0, index); try { AttributeName attNew = ondexMetaData.getAttributeName(name); if (attNew == null) attNew = ondexMetaData.createAttributeName(name, att.getFullname(), att.getDescription(), att.getUnit(), att.getDataType(), att.getSpecialisationOf()); return attNew;
int counter = 1; while (target.getAttribute(an) != null) { String id = anOriginal.getId() + ":" + counter; an = meta.getAttributeName(id); if (an == null) { an = meta.getFactory().createAttributeName(id, anOriginal.getFullname(), anOriginal.getDataType(), anOriginal.getSpecialisationOf()); break;
getAttribute.setInt(2, id); getAttribute.setString(3, "relation"); getAttribute.setString(4, attrname.getId()); String an = attrname.getDataTypeAsString();