/** * 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 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); }
/** * 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 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); }
public static TopicNameIF makeTopicName(TopicIF ntype, TopicIF topicIF, String value, Collection<TopicIF> scope) { TopicMapBuilderIF builder = topicIF.getTopicMap().getBuilder(); TopicNameIF name = builder.makeTopicName(topicIF, ntype, value); Iterator<TopicIF> iter = scope.iterator(); while (iter.hasNext()) { TopicIF scopingTopic = iter.next(); name.addTheme(scopingTopic); } return name; }
public static OccurrenceIF makeOccurrence(TopicIF otype, TopicIF topicIF, String value, LocatorIF datatype, Collection<TopicIF> scope) { TopicMapBuilderIF builder = topicIF.getTopicMap().getBuilder(); OccurrenceIF occ = builder.makeOccurrence(topicIF, otype, value, datatype); Iterator<TopicIF> iter = scope.iterator(); while (iter.hasNext()) { TopicIF scopingTopic = iter.next(); occ.addTheme(scopingTopic); } return occ; }
/** * INTERNAL: Set the topic that the occurrence belongs to. [parent] */ protected void setTopic(TopicIF topic) { // Set parent topic map setTopicMap((topic == null ? null : (TopicMap)topic.getTopicMap())); // Notify transaction valueChanged(LF_topic, topic, true); }
/** * Get the condition occurrence value as a String. */ public String getCondition() { TopicMapIF tm = topic.getTopicMap(); ParsedQueryIF conditionQuery = MenuUtils.optimisticParse( "select $CONDITION from menu:condition(%topic%, $CONDITION)?", tm); return (String)MenuUtils.getFirstValue(topic, conditionQuery); }
private String getTopicId(TopicIF topic) { LocatorIF baseaddr = topic.getTopicMap().getStore().getBaseAddress(); if (baseaddr != null) { String base = baseaddr.getAddress(); Iterator it = topic.getItemIdentifiers().iterator(); while (it.hasNext()) { String extractedId = extractRelativeId(base, (LocatorIF) it.next()); if (extractedId != null) return extractedId; } } return "id" + topic.getObjectId(); }
public Menu(TopicIF topic) { try { this.topic = topic; TopicMapIF tm = topic.getTopicMap(); ParsedQueryIF ownerQuery = MenuUtils.optimisticParse("select $OWNER from " + "menu:owned-by(%topic% : menu:owned, $OWNER : menu:owner)?", tm); owner = (TopicIF)MenuUtils.getFirstValue(topic, ownerQuery); } catch (Exception e) { throw new OntopiaRuntimeException(e); } }
public static AssociationIF makeAssociation( TopicIF aType, TopicIF[] rTypes, TopicIF[] players, Collection<TopicIF> scope) { TopicMapBuilderIF builder = aType.getTopicMap().getBuilder(); AssociationIF assoc = builder.makeAssociation(aType); for (int i=0; i < rTypes.length; i++) { builder.makeAssociationRole(assoc, rTypes[i], players[i]); } return assoc; }
public void testDeclarationContext() throws InvalidQueryException, IOException { load("subclasses.ltm"); int topics = topicmap.getTopics().size(); TopicIF subclass = getTopicById("subclass"); DeclarationContextIF context = parseContext("using xtm for i\"http://www.topicmaps.org/xtm/1.0/core.xtm#\""); update("delete xtm:subclass", context); assertTrue("topic still attached to TM after delete", subclass.getTopicMap() == null); assertTrue("wrong number of topics after delete", topicmap.getTopics().size() == (topics - 1)); }
public void testParam() throws InvalidQueryException, IOException { load("subclasses.ltm"); int topics = topicmap.getTopics().size(); TopicIF subclass = getTopicById("subclass"); Map params = makeArguments("topic", subclass); update("delete %topic%", params); assertTrue("topic still attached to TM after delete", subclass.getTopicMap() == null); assertTrue("wrong number of topics after delete", topicmap.getTopics().size() == (topics - 1)); }
public void testTopicTypeDeletion() { TopicMapIF topicmap = makeTopicMap(); TopicMapBuilderIF builder = topicmap.getBuilder(); TopicIF morituri = builder.makeTopic(); TopicIF instance = builder.makeTopic(morituri); morituri.remove(); assertTrue("Topic still connected to topic map", morituri.getTopicMap() == null); assertTrue("Topic map not empty", topicmap.getTopics().size() == 0); }