@Override public boolean isAssignableFrom(ConceptClass cc) { ConceptClass curr = cc; while (!curr.equals(this)) { curr = curr.getSpecialisationOf(); if (curr == null) { return false; } } return true; }
/** * Returns whether this concept class is a transitive superclass of * <code>cc</code>. */ @Override public boolean isAssignableFrom(ConceptClass cc) { ConceptClass curr = cc; while (!curr.equals(this)) { curr = curr.getSpecialisationOf(); if (curr == null) { return false; } } return true; }
private boolean instanceOf(ConceptClass cc, ONDEXConcept c) { ConceptClass cc_query = c.getOfType(); while (!cc_query.equals(cc)) { if (cc_query.getSpecialisationOf() == null) { return false; } cc_query = cc_query.getSpecialisationOf(); } return true; }
/** * returns whether the ConceptClass <code>subClass</code> equals or is a subclass of * the ConceptClass <code>superClass</code> * * @param subClass the potential subclass * @param superClass the potential superclass * @return the above. */ private boolean inherited(ConceptClass subClass, ConceptClass superClass) { ConceptClass cc_curr = subClass; while (!cc_curr.equals(superClass)) { cc_curr = cc_curr.getSpecialisationOf(); if (cc_curr == null) { return false; } } return true; }
@Override public boolean inheritedFrom(ConceptClass cc) { ConceptClass my_cc = getOfType(); while (!my_cc.equals(cc)) { my_cc = my_cc.getSpecialisationOf(); if (my_cc == null) { return false; } } return true; }
/** * Returns whether this concept is inherited from the given ConceptClass. * This is the case when its ofType cc' either equals cc or is a transitive * specialisation of cc. * * @param conceptClass * the ConceptClass against which to test. * @return whether the above holds. */ @Override public boolean inheritedFrom(ConceptClass conceptClass) { ConceptClass my_cc = getOfType(); while (!my_cc.equals(conceptClass)) { my_cc = my_cc.getSpecialisationOf(); if (my_cc == null) { return false; } } return true; }
/** * Returns node shape code for a given ConceptClass. * * @param cc * ConceptClass * @return shape code */ public static int getShapeForConceptClass(ConceptClass cc) { String key = "ConceptClass.Shape." + cc.getId(); if (visual.getProperty(key) != null) { return Integer.valueOf(visual.getProperty(key)); } else { // maybe parent concept class exist in mapping ConceptClass parent = cc.getSpecialisationOf(); if (parent != null) { return getShapeForConceptClass(parent); } } return defaultShape; }
/** * Returns node size for a given ConceptClass * * @param cc * ConceptClass * @return node size */ public static Integer getSizeForConceptClass(ConceptClass cc) { String key = "ConceptClass.Size." + cc.getId(); if (visual.getProperty(key) != null) { return Integer.valueOf(visual.getProperty(key)); } else { // maybe parent concept class exist in mapping ConceptClass parent = cc.getSpecialisationOf(); if (parent != null) { return getSizeForConceptClass(parent); } } return defaultNodeSize; }
/** * Returns node color for a given ConceptClass. * * @param cc * ConceptClass * @return Color */ public static Color getColorForConceptClass(ConceptClass cc) { String key = "ConceptClass.Color." + cc.getId(); if (visual.getProperty(key) != null) { return convertToColor(visual.getProperty(key)); } else { // maybe parent concept class exist in mapping ConceptClass parent = cc.getSpecialisationOf(); if (parent != null) { return getColorForConceptClass(parent); } } return defaultColor; }
ConceptClass sp = cc.getSpecialisationOf(); if (sp != null) { String spid = sp.getId();
public void run() { // just being paranoid cleanPopups(); if (showMouseOver && vv.isShowing() && onNode && n.equals(currentNode) && !activePopups.containsKey(n)) { ConceptClass cc = n.getOfType(); if (cc.getId().equals("Comp") || (cc.getSpecialisationOf() != null && cc.getSpecialisationOf().getId().equals("Comp"))) { for (Attribute attr : n.getAttributes()) { Object o = attr.getValue(); if (o instanceof ChemicalStructure) { // use Attribute Editor as a hack JComponent c = AttributePanel.findEditor(attr); if (c != null) { c.setBorder(BorderFactory.createEtchedBorder()); c.setPreferredSize(new Dimension(150, 150)); Point location = calculatePopupLocation(c); // show popup PopupFactory popupFactory = PopupFactory.getSharedInstance(); Popup popup = popupFactory.getPopup(vv, c, location.x, location.y); // just being paranoid if (!activePopups.containsKey(n)) { activePopups.put(n, popup); popup.show(); } } } } } } } }, 500);
/** * Constructs user input to add a ConceptClass. * * @param aog * AbstractONDEXGraph to add to * @param conceptClass * Concept Class to use */ public DialogConceptClass(ONDEXGraph aog, ConceptClass conceptClass) { super("Dialog.ConceptClass.Title", "Properties16.gif"); this.aog = aog; initSpecialisationOf(); // set existing information id.setText(conceptClass.getId()); fullname.setText(conceptClass.getFullname()); description.setText(conceptClass.getDescription()); ConceptClass specialisation = conceptClass.getSpecialisationOf(); if (specialisation != null) specialisationOf.setSelectedItem(specialisation.getId()); // set everything to disabled id.setEditable(false); fullname.setEditable(false); description.setEnabled(false); specialisationOf.setEnabled(false); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(makeProperties(), BorderLayout.CENTER); this.getContentPane().add(makeButtonsPanel(null, "Dialog.ConceptClass.Cancel"), BorderLayout.SOUTH); this.pack(); }
ConceptClass sp = cc.getSpecialisationOf(); if (sp != null) { if (!reverseClasses.containsKey(sp))
/** * Cast a given ConceptClass into a BerkeleyConceptClass. * * @param old * ConceptClass * @return BerkeleyConceptClass */ protected static BerkeleyConceptClass convert(ConceptClass old) { BerkeleyConceptClass nu = new BerkeleyConceptClass(old.getSID(), old.getId(), old.getFullname(), old.getDescription(), old.getSpecialisationOf()); return nu; }
/** * @param ccs * @param omd * copy from MetaData * @param nomd * copy to MetaData */ private void copyConceptClasses(Iterable<ConceptClass> ccs, ONDEXGraphMetaData omd, ONDEXGraphMetaData nomd) { // "specializations_of"s that occur before there specialization HashSet<ConceptClass> ccDependencyNotResolved = new HashSet<ConceptClass>(); for (ConceptClass cc : ccs) { ConceptClass ccSpec = cc.getSpecialisationOf(); ConceptClass newCCSpec = null; if (ccSpec != null) { newCCSpec = nomd.getConceptClass(ccSpec.getId()); if (newCCSpec == null) { ccDependencyNotResolved.add(cc); continue; } } if (!nomd.checkConceptClass(cc.getId())) nomd.createConceptClass(cc.getId(), cc.getFullname(), cc .getDescription(), newCCSpec); } // recursively resolve specialisations if (ccDependencyNotResolved.size() > 0) { copyConceptClasses(ccDependencyNotResolved, omd, nomd); } }
@Override public boolean map ( ConceptClass cc, Map<String, Object> params ) { if ( !super.map ( cc, params ) ) return false; String ccId = cc.getId (); if ( contains ( IGNORED_IDS, ccId )) return false; RdfMapperFactory xfact = this.getMapperFactory (); RdfUriGenerator<ConceptClass> uriGen = this.getRdfUriGenerator (); String myiri = uriGen.getUri ( cc, params ); ConceptClass parent = cc.getSpecialisationOf (); String parentIri = parent == null || contains ( IGNORED_IDS, parent.getId () ) ? iri ( "bk:Concept" ) : uriGen.getUri ( parent ); COMMUTILS.assertResource ( xfact.getGraphModel (), myiri, iri ( "rdfs:subClassOf" ), parentIri ); return true; }
ConceptClass spec = cc.getSpecialisationOf(); if (spec != null) { xmlw.writeStartElement(XMLTagNames.SPECIALISATIONOF);
Resource cC = model.createResource(ONDEXRdf.ccToUri(graphURI, cc)); rdfMetadata(cC, cc); if (cc.getSpecialisationOf() != null) cC.addProperty(RDFS.subClassOf, model.createResource(ONDEXRdf.ccToUri(graphURI, cc.getSpecialisationOf())));
ConceptClass superClass = cc.getSpecialisationOf(); if (superClass != null) { rdfsClass.addSuperClass(model.getOntClass(urlPrefixMetaData + superClass.getId()));