/** * INTERNAL: Sets the current topic map. */ public void setTopicMap(TopicMapIF topicmap) { this.topicmap = topicmap; this.builder = topicmap.getBuilder(); this.qp = null; this.dc = null; }
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; }
protected static OccurrenceIF addOccurrence(TopicMap topicMap, LocatorIF base_on, TopicIF topic, String otype, String datatype, String value) { TopicMapIF topicmap = topicMap.getTopicMapIF(); TopicMapBuilderIF builder = topicmap.getBuilder(); LocatorIF dt; if (datatype.equals("datatype-string")) dt = DataTypes.TYPE_STRING; else if (datatype.equals("datatype-number")) dt = DataTypes.TYPE_DECIMAL; else throw new RuntimeException("Unsupported datatype: " + datatype); return builder.makeOccurrence(topic, getTopic(topicmap, base_on, otype), value, dt); }
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; }
private TopicIF getLastModifiedTopic(TopicMapIF topicmap) { TopicIF lastmod = topicmap.getTopicBySubjectIdentifier(psi); if (lastmod == null) { lastmod = topicmap.getBuilder().makeTopic(); lastmod.addSubjectIdentifier(psi); } return lastmod; }
private static TopicIF makeTopic(TopicMapIF tm, String id) throws MalformedURLException { TopicMapBuilderIF builder = tm.getBuilder(); TopicIF topic = builder.makeTopic(); topic.addSubjectIdentifier(new URILocator(RAPServlet.RAP_NAMESPACE + id)); return topic; }
private TopicIF getPasswordTopic(TopicMapIF topicmap) { TopicIF passwd = topicmap.getTopicBySubjectIdentifier(psi); if (passwd == null) { passwd = topicmap.getBuilder().makeTopic(); passwd.addSubjectIdentifier(psi); } return passwd; }
private static void addAssociation1(LocatorIF atypePSI, TopicIF player1, LocatorIF rtype1PSI, TopicMapIF tm) throws MalformedURLException { TopicMapBuilderIF tmbuilder = tm.getBuilder(); AssociationIF assoc = tmbuilder.makeAssociation(topicByPSI(atypePSI, tm)); tmbuilder.makeAssociationRole(assoc, topicByPSI(rtype1PSI, tm), player1); }
public void perform(ActionParametersIF params, ActionResponseIF response) { AssociationIF assoc = (AssociationIF) params.get(0); TopicIF player = (TopicIF) params.getTMObjectValue(); if (player == null) return; // nothing to be done TopicIF type = (TopicIF) params.get(1); TopicMapBuilderIF builder = assoc.getTopicMap().getBuilder(); builder.makeAssociationRole(assoc, type, player); }
public QueryField createQueryField() { TopicMap tm = getTopicMap(); TopicMapBuilderIF builder = tm.getTopicMapIF().getBuilder(); // create name field TopicIF queryFieldType = OntopolyModelUtils.getTopicIF(tm, PSI.ON, "query-field"); TopicIF queryFieldTopic = builder.makeTopic(queryFieldType); // add field QueryField queryField = new QueryField(queryFieldTopic, tm); addField(queryField); return queryField; }
private static void addAssociation2(LocatorIF atypePSI, TopicIF player1, LocatorIF rtype1PSI, TopicIF player2, LocatorIF rtype2PSI, TopicMapIF tm) throws MalformedURLException { TopicMapBuilderIF tmbuilder = tm.getBuilder(); AssociationIF assoc = tmbuilder.makeAssociation(topicByPSI(atypePSI, tm)); tmbuilder.makeAssociationRole(assoc, topicByPSI(rtype1PSI, tm), player1); tmbuilder.makeAssociationRole(assoc, topicByPSI(rtype2PSI, tm), player2); }
protected static void assignField(TopicMapIF topicmap, LocatorIF base_on, TopicIF oField, TopicIF ptype) { TopicMapBuilderIF builder = topicmap.getBuilder(); // TopicIF cardinality = getTopic(topicmap, base_on, "cardinality-0-1"); // NOTE: fixed // on:has-field(%new-field-assignment% : on:field-assignment, %new-role-field% : on:field-definition) AssociationIF a2 = builder.makeAssociation(getTopic(topicmap, base_on, "has-field")); builder.makeAssociationRole(a2, getTopic(topicmap, base_on, "field-owner"), ptype); builder.makeAssociationRole(a2, getTopic(topicmap, base_on, "field-definition"), oField); }
private TopicIF getDefaultNameType() { TopicMapIF tm = getTopicMap(); TopicIF nameType = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (nameType == null) { nameType = tm.getBuilder().makeTopic(); nameType.addSubjectIdentifier(PSI.getSAMNameType()); } return nameType; }
@Override public Variant createVariant(Locator value, Collection<Topic> scope) { Check.valueNotNull(this, value); Check.scopeNotNull(this, scope); Check.scopeNotEmpty(this, scope); Collection<Topic> explicitScope = new ArrayList<Topic>(scope); VariantNameIF variant = topicMap.getWrapped().getBuilder().makeVariantName( wrapped, topicMap.unwrapLocator(value), unwrapScope(scope)); VariantImpl v = topicMap.wrapVariant(variant); v.setExplicitScope(explicitScope); return v; }
protected static void assignFieldsView(TopicMapIF topicmap, LocatorIF base_on, TopicIF fieldDefinition, String view) { TopicMapBuilderIF builder = topicmap.getBuilder(); TopicIF fieldsView = getTopic(topicmap, base_on, view); AssociationIF fieldInView = builder.makeAssociation(getTopic(topicmap, base_on, "field-in-view")); builder.makeAssociationRole(fieldInView, getTopic(topicmap, base_on, "field-definition"), fieldDefinition); builder.makeAssociationRole(fieldInView, getTopic(topicmap, base_on, "fields-view"), fieldsView); }
protected static void assignEditMode(TopicMapIF topicmap, LocatorIF base_on, TopicIF rfield, String mode) { TopicMapBuilderIF builder = topicmap.getBuilder(); AssociationIF isEmbedded = builder.makeAssociation(getTopic(topicmap, base_on, "use-edit-mode")); builder.makeAssociationRole(isEmbedded, getTopic(topicmap, base_on, "field-definition"), rfield); builder.makeAssociationRole(isEmbedded, getTopic(topicmap, base_on, "edit-mode"), getTopic(topicmap, base_on, mode)); }
protected static void assignViewMode(TopicMapIF topicmap, LocatorIF base_on, TopicIF rfield, String view, String mode) { TopicMapBuilderIF builder = topicmap.getBuilder(); AssociationIF viewMode = builder.makeAssociation(getTopic(topicmap, base_on, "use-view-mode")); builder.makeAssociationRole(viewMode, getTopic(topicmap, base_on, "field-definition"), rfield); builder.makeAssociationRole(viewMode, getTopic(topicmap, base_on, "fields-view"), getTopic(topicmap, base_on, view)); builder.makeAssociationRole(viewMode, getTopic(topicmap, base_on, "view-mode"), getTopic(topicmap, base_on, mode)); }
protected static void assignValueView(TopicMapIF topicmap, LocatorIF base_on, TopicIF rfield, String pview, String cview) { TopicMapBuilderIF builder = topicmap.getBuilder(); AssociationIF valueView = builder.makeAssociation(getTopic(topicmap, base_on, "use-value-view")); builder.makeAssociationRole(valueView, getTopic(topicmap, base_on, "field-definition"), rfield); builder.makeAssociationRole(valueView, getTopic(topicmap, base_on, "parent-view"), getTopic(topicmap, base_on, pview)); builder.makeAssociationRole(valueView, getTopic(topicmap, base_on, "child-view"), getTopic(topicmap, base_on, cview)); }
@Override public Occurrence createOccurrence(Topic type, Locator value, Topic... scope) { Check.typeNotNull(this, type); Check.valueNotNull(this, value); Check.scopeNotNull(this, scope); Check.scopeInTopicMap(getTopicMap(), scope); Check.typeInTopicMap(getTopicMap(), type); OccurrenceIF occ = topicMap.getWrapped().getBuilder().makeOccurrence( wrapped, topicMap.unwrapTopic(type), topicMap.unwrapLocator(value)); applyScope(occ, scope); return topicMap.wrapOccurrence(occ); }
protected static TopicIF defineIdentityField(TopicMapIF topicmap, LocatorIF base_on, TopicIF itype, TopicIF cardinality) { TopicMapBuilderIF builder = topicmap.getBuilder(); TopicIF iField = builder.makeTopic(getTopic(topicmap, base_on, "identity-field")); AssociationIF hasOccurrenceType = builder.makeAssociation(getTopic(topicmap, base_on, "has-identity-type")); builder.makeAssociationRole(hasOccurrenceType, getTopic(topicmap, base_on, "identity-type"), itype); builder.makeAssociationRole(hasOccurrenceType, getTopic(topicmap, base_on, "identity-field"), iField); AssociationIF hasCardinality = builder.makeAssociation(getTopic(topicmap, base_on, "has-cardinality")); builder.makeAssociationRole(hasCardinality, getTopic(topicmap, base_on, "field-definition"), iField); builder.makeAssociationRole(hasCardinality, getTopic(topicmap, base_on, "cardinality"), cardinality); return iField; }