@Override public boolean isAssignableFrom(RelationType rt) { RelationType curr = rt; while (!curr.equals(this)) { curr = curr.getSpecialisationOf(); if (curr == null) { return false; } } return true; }
/** * 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; }
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; }
@Override public boolean inheritedFrom(RelationType rt) { RelationType my_rt = getOfType(); while (!my_rt.equals(rt)) { my_rt = my_rt.getSpecialisationOf(); if (my_rt == null) { return false; } } return true; }
/** * Returns whether this relation is inherited from the given RelationType. * This is the case when its ofType rt' either equals rt or is a transitive * specialisation of rt. * * @param rt * the RelationType against which to test. * @return whether the above holds. */ @Override public boolean inheritedFrom(RelationType rt) { RelationType my_rt = getOfType(); while (!my_rt.equals(rt)) { my_rt = my_rt.getSpecialisationOf(); if (my_rt == null) { return false; } } return true; }
/** * 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; }
RelationType sp = rt.getSpecialisationOf(); if (sp != null) { String spid = sp.getId();
/** * 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; }
/** * 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; }
inverse.setText(relationType.getInverseName()); if (relationType.getSpecialisationOf() != null) specialisationOf.setSelectedItem(relationType.getSpecialisationOf().getId());
RelationType sp = rt.getSpecialisationOf(); if (sp != null) { if (!reverseTypes.containsKey(sp)) {
@Override public boolean map ( RelationType rt, Map<String, Object> params ) { if ( !super.map ( rt, params ) ) return false; String ccId = rt.getId (); if ( contains ( IGNORED_IDS, ccId )) return false; RdfMapperFactory xfact = this.getMapperFactory (); RdfUriGenerator<RelationType> uriGen = this.getRdfUriGenerator (); String myiri = uriGen.getUri ( rt, params ); RelationType parent = rt.getSpecialisationOf (); String parentIri = parent == null || contains ( IGNORED_IDS, parent.getId () ) ? iri ( "bk:conceptsRelation" ) : uriGen.getUri ( parent ); COMMUTILS.assertResource ( xfact.getGraphModel (), myiri, iri ( "rdfs:subPropertyOf" ), parentIri ); return true; }
RelationType spec = rt.getSpecialisationOf(); RelationType newSpec = null; if (spec != null) {
/** * 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; }
xmlw.writeEndElement(); RelationType specialisationOf = rt.getSpecialisationOf();
Resource rT = model.createResource(ONDEXRdf.rtToUri(graphURI, rt)); rdfMetadata(rT, rt); if (rt.getSpecialisationOf() != null) rT.addProperty(RDFS.subPropertyOf, model.createResource(ONDEXRdf.rtToUri(graphURI, rt.getSpecialisationOf())));
RelationType superRt = rt.getSpecialisationOf(); if (superRt != null) { objectProperty.addSuperProperty(model.getObjectProperty(urlPrefixMetaData + superRt.getId()));