|
From: <bo...@us...> - 2009-08-17 10:56:25
|
Revision: 350
http://tinytim.svn.sourceforge.net/tinytim/?rev=350&view=rev
Author: bosso
Date: 2009-08-17 10:56:16 +0000 (Mon, 17 Aug 2009)
Log Message:
-----------
minor bugfix
Modified Paths:
--------------
tinytim-mio/trunk/src/main/java/org/tinytim/mio/CTMTopicMapWriter.java
tinytim-mio/trunk/src/main/java/org/tinytim/mio/internal/ctm/impl/DefaultTMCLPreprocessor.java
Modified: tinytim-mio/trunk/src/main/java/org/tinytim/mio/CTMTopicMapWriter.java
===================================================================
--- tinytim-mio/trunk/src/main/java/org/tinytim/mio/CTMTopicMapWriter.java 2009-08-17 10:43:24 UTC (rev 349)
+++ tinytim-mio/trunk/src/main/java/org/tinytim/mio/CTMTopicMapWriter.java 2009-08-17 10:56:16 UTC (rev 350)
@@ -561,7 +561,8 @@
TMCL.SUBJECT_LOCATOR_CONSTRAINT,
TMCL.TOPIC_NAME_CONSTRAINT,
TMCL.TOPIC_OCCURRENCE_CONSTRAINT,
- TMCL.ROLE_PLAYER_CONSTRAINT, TMCL.SCOPE_CONSTRAINT,
+ TMCL.TOPIC_ROLE_CONSTRAINT,
+ TMCL.SCOPE_CONSTRAINT,
TMCL.REIFIER_CONSTRAINT,
TMCL.ASSOCIATION_ROLE_CONSTRAINT,
TMCL.ROLE_COMBINATION_CONSTRAINT,
Modified: tinytim-mio/trunk/src/main/java/org/tinytim/mio/internal/ctm/impl/DefaultTMCLPreprocessor.java
===================================================================
--- tinytim-mio/trunk/src/main/java/org/tinytim/mio/internal/ctm/impl/DefaultTMCLPreprocessor.java 2009-08-17 10:43:24 UTC (rev 349)
+++ tinytim-mio/trunk/src/main/java/org/tinytim/mio/internal/ctm/impl/DefaultTMCLPreprocessor.java 2009-08-17 10:56:16 UTC (rev 350)
@@ -150,6 +150,7 @@
_processNameConstraints(topicMap, tiIdx, topics, assocs);
_processScopeConstraints(topicMap, tiIdx, topics, assocs);
_processReifierConstraints(topicMap, tiIdx, topics, assocs);
+ _processTopicReifiesConstraints(topicMap, tiIdx, topics, assocs);
_processBelongsToSchema(topicMap, tiIdx, topics, assocs);
}
@@ -345,17 +346,17 @@
TypeInstanceIndex tiIdx, Collection<Topic> topics,
Collection<Association> assocs) {
for (Topic constraint : _getConstraintInstances(topicMap, tiIdx,
- TMCL.BELONGS_TO_SCHEMA)) {
+ TMCL.REIFIER_CONSTRAINT)) {
_processReifierConstraint(constraint, topics, assocs);
}
}
-
+
private void _processReifierConstraint(Topic constraint,
Collection<Topic> topics, Collection<Association> assocs) {
- Topic reifierType = _getConstrainedStatementPlayer(constraint, assocs);
- Topic reifiableType = _getAllowedReifierPlayer(constraint, assocs);
-
+ Topic reifiableType = _getConstrainedStatementPlayer(constraint, assocs);
+ Topic reifierType = _getAllowedReifierPlayer(constraint, assocs);
+
ILiteral cardMin = _getCardMin(constraint);
ILiteral cardMax = _getCardMax(constraint);
DefaultTemplate tpl = null;
@@ -371,10 +372,47 @@
else {
tpl = new DefaultTemplate("may-have-reifier");
tpl.addParameter(reifierType);
+
+ }
+
+ _registerTemplate(reifiableType, tpl);
+ removeConstraint(constraint, topics, 2);
+ }
+ private void _processTopicReifiesConstraints(TopicMap topicMap,
+ TypeInstanceIndex tiIdx, Collection<Topic> topics,
+ Collection<Association> assocs) {
+ for (Topic constraint : _getConstraintInstances(topicMap, tiIdx,
+ TMCL.TOPIC_REIFIES_CONSTRAINT)) {
+ _processTopicReifiesConstraint(constraint, topics, assocs);
}
- _registerTemplate(reifiableType, tpl);
+ }
+
+ private void _processTopicReifiesConstraint(Topic constraint,
+ Collection<Topic> topics, Collection<Association> assocs) {
+ Topic reifiableType = _getConstrainedStatementPlayer(constraint, assocs);
+ Topic reifierType = _getConstrainedTopicTypePlayer(constraint, assocs);
+
+ ILiteral cardMin = _getCardMin(constraint);
+ ILiteral cardMax = _getCardMax(constraint);
+ DefaultTemplate tpl = null;
+ if (cardMin.getValue().equals(cardMax.getValue())) {
+ if (cardMin.getValue().equals("0")) {
+ tpl = new DefaultTemplate("cannot-reify");
+ }
+ else {
+ tpl = new DefaultTemplate("must-reify");
+ tpl.addParameter(reifiableType);
+ }
+ }
+ else {
+ tpl = new DefaultTemplate("may");
+ tpl.addParameter(reifiableType);
+
+ }
+
+ _registerTemplate(reifierType, tpl);
removeConstraint(constraint, topics, 2);
}
@@ -382,7 +420,7 @@
TypeInstanceIndex tiIdx, Collection<Topic> topics,
Collection<Association> assocs) {
for (Topic constraint : _getConstraintInstances(topicMap, tiIdx,
- TMCL.ROLE_PLAYER_CONSTRAINT)) {
+ TMCL.TOPIC_ROLE_CONSTRAINT)) {
_processRolePlayerConstraint(constraint, topics, assocs);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|