@Override public void modify(TMObjectIF object, Object v) { if (!(object instanceof TopicIF)) return; TopicIF topic = (TopicIF) object; String value = (String) v; try { topic.removeSubjectIdentifier(new URILocator(value)); } catch (MalformedURLException e) { throw new OntopiaRuntimeException("Invalid URI: " + value); } } }
@Override public void removeSubjectIdentifier(Locator sid) { if (sid == null) { throw new ModelConstraintException(this, "The subject identifier must not be null"); } wrapped.removeSubjectIdentifier(topicMap.unwrapLocator(sid)); }
protected void addItemIdentifier(TopicIF topic, LocatorIF locator) { // Check to see if source locator is a subject indicator of // another topic. If so they should merge. TopicIF other_topic = topicmap.getTopicBySubjectIdentifier(locator); if (other_topic != null) { if (log.isInfoEnabled()) log.info("Topic " + topic + " merged with + " + other_topic + " because the source locator is the same as the subject indicator of the other: " + locator); // Merge topic with other topic. MergeUtils.mergeInto(topic, other_topic); // Subject indicator is no longer needed topic.removeSubjectIdentifier(locator); } // Add source locator to object topic.addItemIdentifier(locator); }
protected static void renameSubjectIdentifier(TopicMapIF topicmap, LocatorIF base_on, String oldId, String newId) { TopicIF identityType = getTopic(topicmap, base_on, oldId); identityType.addSubjectIdentifier(base_on.resolveAbsolute(newId)); identityType.removeSubjectIdentifier(base_on.resolveAbsolute(oldId)); }
protected static void renameSubjectIdentifier(TopicMapIF topicmap, LocatorIF base_on, String oldId, String newId) { TopicIF identityType = getTopic(topicmap, base_on, oldId); identityType.addSubjectIdentifier(base_on.resolveAbsolute(newId)); identityType.removeSubjectIdentifier(base_on.resolveAbsolute(oldId)); }
public void perform(ActionParametersIF params, ActionResponseIF response) { //test params ActionSignature paramsType = ActionSignature.getSignature("t ls"); paramsType.validateArguments(params, this); TopicIF topic = (TopicIF) params.get(0); Object param1 = params.get(1); LocatorIF locator = null; if (param1 instanceof LocatorIF) locator = (LocatorIF) param1; else if (param1 instanceof String) { try { locator = new URILocator((String) param1); } catch (MalformedURLException e) { throw new ActionRuntimeException("Unable to create URI locator from '" + param1 + "'", false); } } else throw new ActionRuntimeException("Unable to create URI locator." + " Second parameter to RemoveSubjectIndicator must be either a" + " LocatorIF or a String, but was a " + param1.getClass().getName() + ".", true); topic.removeSubjectIdentifier(locator); }
@Override protected void transform() throws InvalidQueryException { // rename http://psi.ontopia.net/ontology/role-type to "Role type" doUpdate("update value($TN, \"Role type\") " + "from topic-name(on:role-type, $TN)"); // FIXME // http://psi.ontopia.net/ontology/rf-role-type_has-role-type // should be part of Advanced view only // FIXME // http://psi.ontopia.net/ontology/rf-association-field_has-association-type // should have cardinality 1:1 or 1:M // - same applies to fields for name type, identity type, and // occurrence type // FIXME // http://psi.ontopia.net/ontology/rf-association-field_has-association-field // should have cardinality 1:M // FIXME (can't be bothered myself) // rename superclass to supertype and subclass to subtype // change PSI of default name type from own to TMDM PSI TopicMapIF tm = topicMap.getTopicMapIF(); TopicIF defnametype = tm.getTopicBySubjectIdentifier(PSI.ON_DEPRECATED_UNTYPED_NAME); defnametype.removeSubjectIdentifier(PSI.ON_DEPRECATED_UNTYPED_NAME); defnametype.addSubjectIdentifier(PSI.TMDM_TOPIC_NAME); }
@Override protected void transform() throws InvalidQueryException { // rename http://psi.ontopia.net/ontology/role-type to "Role type" doUpdate("update value($TN, \"Role type\") " + "from topic-name(on:role-type, $TN)"); // FIXME // http://psi.ontopia.net/ontology/rf-role-type_has-role-type // should be part of Advanced view only // FIXME // http://psi.ontopia.net/ontology/rf-association-field_has-association-type // should have cardinality 1:1 or 1:M // - same applies to fields for name type, identity type, and // occurrence type // FIXME // http://psi.ontopia.net/ontology/rf-association-field_has-association-field // should have cardinality 1:M // FIXME (can't be bothered myself) // rename superclass to supertype and subclass to subtype // change PSI of default name type from own to TMDM PSI TopicMapIF tm = topicMap.getTopicMapIF(); TopicIF defnametype = tm.getTopicBySubjectIdentifier(PSI.ON_DEPRECATED_UNTYPED_NAME); defnametype.removeSubjectIdentifier(PSI.ON_DEPRECATED_UNTYPED_NAME); defnametype.addSubjectIdentifier(PSI.TMDM_TOPIC_NAME); }
public void setSubjectIdentifiers(TopicIF object, Topic pojo) { if (pojo.getSubjectIdentifiers() != null) { Collection<LocatorIF> toRemove = CollectionUtils.subtract(object.getSubjectIdentifiers(), pojo.getSubjectIdentifiers()); for (LocatorIF si : pojo.getSubjectIdentifiers()) { object.addSubjectIdentifier(si); } for (LocatorIF si : toRemove) { object.removeSubjectIdentifier(si); } } }
@Override public void run() { TopicIF t = getTopic(); t.removeSubjectIdentifier(URILocator.create("x:subject-indicator")); this.objectId = t.getObjectId(); } });
/** * Removes the subject locator or a subject identifier from a topic. * * @param _value * value which is going to be removed from the topic. */ @Override public void removeValue(Topic topic, Object _value, LifeCycleListener listener) { TopicIF topicIf = topic.getTopicIF(); LocatorIF value = (_value instanceof LocatorIF ? (LocatorIF) _value : URILocator.create((String) _value)); if (value != null) { if (listener != null) listener.onBeforeRemove(topic, this, value); if (isSubjectLocator()) topicIf.removeSubjectLocator(value); else if (isItemIdentifier()) topicIf.removeItemIdentifier(value); else topicIf.removeSubjectIdentifier(value); } }
if (locator != null && (param1 instanceof LocatorIF || param1 instanceof String)) topic.removeSubjectIdentifier(locator); } catch (MalformedURLException e) { throw new ActionRuntimeException("Malformed URL for subject identifier: '" + newAddress + "'", false);
/** * Removes the subject locator or a subject identifier from a topic. * * @param _value * value which is going to be removed from the topic. */ @Override public void removeValue(Topic topic, Object _value, LifeCycleListener listener) { TopicIF topicIf = topic.getTopicIF(); LocatorIF value = (_value instanceof LocatorIF ? (LocatorIF) _value : URILocator.create((String) _value)); if (value != null) { if (listener != null) listener.onBeforeRemove(topic, this, value); if (isSubjectLocator()) topicIf.removeSubjectLocator(value); else if (isItemIdentifier()) topicIf.removeItemIdentifier(value); else topicIf.removeSubjectIdentifier(value); } }
topic.removeSubjectIdentifier(indicator); assertTrue("indicator not removed", topic.getSubjectIdentifiers().size() == 0); topic.removeSubjectIdentifier(indicator);
source.removeSubjectIdentifier(subjectIdentifier);
public void testBug652a() { try { TopicIF topic = builder.makeTopic(); URILocator loc = new URILocator("http://www.ontopia.net/A"); topic.addItemIdentifier(loc); topic.addSubjectIdentifier(loc); topic.removeSubjectIdentifier(loc); topic.removeItemIdentifier(loc); topic.remove(); } catch (MalformedURLException e) { fail("(INTERNAL) bad URL given" + e); } }
public void testBug652b() { try { TopicIF topic = builder.makeTopic(); URILocator loc = new URILocator("http://www.ontopia.net/B"); topic.addSubjectIdentifier(loc); topic.addItemIdentifier(loc); topic.removeItemIdentifier(loc); topic.removeSubjectIdentifier(loc); topic.remove(); } catch (MalformedURLException e) { fail("(INTERNAL) bad URL given" + e); } }
assertTrue("topic not found by indicator", found.equals(topic)); topic.removeSubjectIdentifier(loc); found = tm.getTopicBySubjectIdentifier(loc); assertTrue("topic found by indicator when it shouldn't be",
_topic2.removeSubjectIdentifier(new URILocator("test:eva_kernst")); store2.commit();
topic1.removeSubjectIdentifier(subind); topic1.removeSubjectLocator(subloc); topic1.removeItemIdentifier(srcloc);