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; }
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; }
public void perform(ActionParametersIF params, ActionResponseIF response) { //test params ActionSignature paramsType = ActionSignature.getSignature("t t t?&"); paramsType.validateArguments(params, this); TopicIF topic = (TopicIF) params.get(0); TopicIF occtype = (TopicIF) params.get(1); Collection themes = params.getCollection(2); String value = params.getStringValue().trim(); TopicMapBuilderIF builder = topic.getTopicMap().getBuilder(); // do not create occurrence with empty string value if (value == null || value.equals("")) return; // create new (internal) occurrence for topic OccurrenceIF occurrence = builder.makeOccurrence(topic, occtype, value); // set scope, if provided if (themes != null) { Iterator it = themes.iterator(); while (it.hasNext()) occurrence.addTheme((TopicIF) it.next()); } } }
fieldOrderP2 = (fieldOrderMax == 0 ? 0 : fieldOrderMax + Ordering.ORDER_INCREMENTS); p2occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(fieldOrderP2), datatype); p2occ.addTheme(fieldDefinitionIf); p2occ.addTheme(p2topic); } else { fieldOrderP2 = Ordering.stringToOrder(p2occ.getValue()); } else { p1occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); p1occ.addTheme(fieldDefinitionIf); p1occ.addTheme(p1topic); } else { p1occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); p1occ.addTheme(fieldDefinitionIf); p1occ.addTheme(p1topic); nextOrder += Ordering.ORDER_INCREMENTS; OccurrenceIF occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); occ.addTheme(fieldDefinitionIf); occ.addTheme(atopic.getTopicIF());
Iterator it = themes.iterator(); while (it.hasNext()) occurrence.addTheme((TopicIF) it.next());
fieldOrderP2 = (fieldOrderMax == 0 ? 0 : fieldOrderMax + Ordering.ORDER_INCREMENTS); p2occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(fieldOrderP2), datatype); p2occ.addTheme(fieldDefinitionIf); p2occ.addTheme(p2topic); } else { fieldOrderP2 = Ordering.stringToOrder(p2occ.getValue()); } else { p1occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); p1occ.addTheme(fieldDefinitionIf); p1occ.addTheme(p1topic); } else { p1occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); p1occ.addTheme(fieldDefinitionIf); p1occ.addTheme(p1topic); nextOrder += Ordering.ORDER_INCREMENTS; OccurrenceIF occ = builder.makeOccurrence(topicIf, typeIf, Ordering.orderToString(nextOrder), datatype); occ.addTheme(fieldDefinitionIf); occ.addTheme(atopic.getTopicIF());
@Override public void run() { OccurrenceIF o = getOccurrence(); TopicIF theme = builder.makeTopic(); this.data.put("scope", theme); o.addTheme(theme); this.objectId = o.getObjectId(); this.value = theme.getObjectId(); } });
occ.addTheme((TopicIF)f[2]); fOrder = fOrder + 1000;
/** * PUBLIC: Merges the source occurrence into the target topic in * another topic map. Makes no attempt to verify that the source * topic represents the same subject as the target topic. * @return The new occurrence in the target topic map. * @since 5.1.3 */ public static OccurrenceIF mergeInto(TopicIF target, OccurrenceIF source) { TopicMapIF tm = target.getTopicMap(); TopicMapBuilderIF builder = tm.getBuilder(); TopicIF type = findTopic(tm, source.getType()); OccurrenceIF newocc = builder.makeOccurrence(target, type, source.getValue(), source.getDataType()); for (TopicIF theme : source.getScope()) newocc.addTheme(findTopic(tm, theme)); return newocc; }
occ.addTheme((TopicIF)f[2]); fOrder = fOrder + 1000;
public void testMergeOccurrenceScopeUse() { try { TopicIF t1 = builder1.makeTopic(); TopicIF t2 = builder1.makeTopic(); TopicIF ot = builder1.makeTopic(); OccurrenceIF occ = builder1.makeOccurrence(t1, ot, ""); occ.addTheme(t2); MergeUtils.mergeInto(t1, t2); assertTrue("occurrence scope corrupted", occ.getScope().size() == 1); assertTrue("occurrence theme replacement not done correctly", occ.getScope().contains(t1)); } catch (ConstraintViolationException e) { fail("merge of topics unaccountably failed" + e.getMessage()); } }
occurrence.addTheme(morituri); name.addTheme(morituri);
oc.addTheme(oc_theme);
oc.addTheme(other); afterTest();