/** * INTERNAL: Returns true if the TopicIF object is an instance * the given type. */ public static boolean isInstanceOf(TopicIF topic, TopicIF type) { return (topic.getTypes().contains(type)); }
private static void copyTypes(TopicIF target, TopicIF source) { Iterator<TopicIF> it = source.getTypes().iterator(); while (it.hasNext()) target.addType(it.next()); }
@Override public void processEvent(TopicIF topic, String event, TopicIF new_value, TopicIF old_value) { // Register types Collection<TopicIF> types = topic.getTypes(); if (types.size() == 1 && types.contains(old_value)) // Unregister null type objects.add(null, topic); // Unregister type objects.remove(old_value, topic); } }
/** * Tests whether this topic is a topic type. * * @return true if this is a topic type. */ public boolean isTopicType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_TOPIC_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is a topic map. * * @return true if this is a topic map. */ public boolean isTopicMap() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_TOPIC_MAP); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is an association type. * * @return true if this is an association type. */ public boolean isAssociationType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_ASSOCIATION_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is a role type. * * @return true if this is a role type. */ public boolean isRoleType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_ROLE_TYPE); return topicIF.getTypes().contains(type); }
@Override public void processEvent(TopicIF topic, String event, TopicIF new_value, TopicIF old_value) { // Register types Collection<TopicIF> types = topic.getTypes(); if (types.isEmpty()) // Unregister null type objects.remove(null, topic); // Register type objects.add(new_value, topic); } }
private void addTypesTreeNodeTo(DefaultMutableTreeNode parent) { Iterator types = target.getTypes().iterator(); if (types.hasNext()) { DefaultMutableTreeNode root = new DefaultMutableTreeNode(Messages .getString("Viz.PropertiesTypes")); while (types.hasNext()) { root.add(new DynamicUtilTreeNode(controller.getStringifier() .toString(types.next()), null)); } parent.add(root); } }
/** * Tests whether this topic is a topic type. * * @return true if this is a topic type. */ public boolean isTopicType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_TOPIC_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is an occurrence type. * * @return true if this is an occurrence type. */ public boolean isOccurrenceType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_OCCURRENCE_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is a role type. * * @return true if this is a role type. */ public boolean isRoleType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_ROLE_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is an occurrence type. * * @return true if this is an occurrence type. */ public boolean isOccurrenceType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_OCCURRENCE_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is a name type. * * @return true if this is a name type. */ public boolean isNameType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_NAME_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is an ontology type, i.e. topic type, * name type, occurrence type, association type or role type. * * @return true if this is an ontology type. */ public boolean isOntologyType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_ONTOLOGY_TYPE); return topicIF.getTypes().contains(type); }
/** * Tests whether this topic is an association type. * * @return true if this is an association type. */ public boolean isAssociationType() { TopicIF type = topicIF.getTopicMap().getTopicBySubjectIdentifier(PSI.ON_ASSOCIATION_TYPE); return topicIF.getTypes().contains(type); }
protected Set<OccurrenceIF> fetchProperties(TopicMapIF topicmap) { TopicIF preferencePropertyType = TopicMapPreferencesOntology.PREFERENCEPROPERTY.t(topicmap); Set<OccurrenceIF> result = new HashSet<OccurrenceIF>(); for (OccurrenceIF property : revitalize(topic, topicmap).getOccurrences()) { if (property.getType().getTypes().contains(preferencePropertyType)) { result.add(property); } } return result; }
/** * Tests whether this association type is hierarchical. * * @return true if this is association type is hierarchical. */ public boolean isHierarchical() { TopicIF hierarchicalRelationType = OntopolyModelUtils.getTopicIF(getTopicMap(), PSI.TECH_HIERARCHICAL_RELATION_TYPE); return getTopicIF().getTypes().contains(hierarchicalRelationType); }
@Override public void run(MasterTest mt) { TopicIF t = (TopicIF)topicmap.getObjectById(mt.objectId); TopicIF type = (TopicIF)topicmap.getObjectById(mt.value); assertTrue("Topic type is not set", t.getTypes().contains(type)); } });
public void testDIODynamic() throws InvalidQueryException, IOException { load("instance-of.ltm"); TopicIF topic = getTopicById("topic1"); update("delete direct-instance-of($I, $T) from $I = topic1, $T = type1"); assertTrue("topic retains type after delete", topic.getTypes().isEmpty()); }