Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 512   Methods: 88
NCLOC: 377   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
WSMLEnumerator.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3   
 4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
 5   
 6    This library is free software; you can redistribute it and/or modify it under
 7    the terms of the GNU Lesser General Public License as published by the Free
 8    Software Foundation; either version 2.1 of the License, or (at your option)
 9    any later version.
 10    This library is distributed in the hope that it will be useful, but WITHOUT
 11    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 12    FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 13    details.
 14    You should have received a copy of the GNU Lesser General Public License along
 15    with this library; if not, write to the Free Software Foundation, Inc.,
 16    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18   
 19    package com.ontotext.wsmo4j.serializer.wsml;
 20   
 21    /**
 22    * <p>Title: WSMO4J</p>
 23    * <p>Description: WSMO API and a Reference Implementation</p>
 24    * <p>Copyright: Copyright (c) 2004-2005</p>
 25    * <p>Company: OntoText Lab. / SIRMA </p>
 26    * @author not attributable
 27    * @version 1.0
 28    *
 29    */
 30    import java.util.*;
 31   
 32    import org.omwg.logicalexpression.*;
 33    import org.omwg.ontology.*;
 34    import org.wsmo.common.*;
 35    import org.wsmo.mediator.*;
 36    import org.wsmo.service.*;
 37   
 38    public class WSMLEnumerator implements Visitor {
 39   
 40    private final static boolean USE_MULTIPLE_INTERFACE_LIST = false;
 41   
 42  0 public void visit(IRI uri) {
 43  0 throw new UnsupportedOperationException("this should not happen");
 44    }
 45   
 46  0 public void visit(Entity item) {
 47  0 Map map = item.listNFPValues();
 48  0 if (map.size() > 0) {
 49  0 inEntity(item);
 50   
 51  0 Iterator iter = map.entrySet().iterator();
 52  0 while (iter.hasNext()) {
 53  0 Map.Entry en = (Map.Entry)iter.next();
 54  0 IRI key = (IRI)en.getKey();
 55  0 Set vals = (Set)en.getValue();
 56  0 onNFPKeyValues(key, vals);
 57    }
 58   
 59  0 outEntity(item);
 60    }
 61    }
 62  0 public void inEntity(Entity item) { }
 63  0 public void onNFPKeyValues(IRI key, Set vals) { }
 64  0 public void outEntity(Entity item) { }
 65   
 66   
 67  0 public void visit(TopEntity item) {
 68  0 inTopEntity(item);
 69  0 visit((Entity)item);
 70  0 Set list = item.listOntologies();
 71  0 if (list.size() > 0) {
 72  0 inImportsOntologies(item);
 73  0 onImportedOntologies(list);
 74  0 outImportsOntologies(item);
 75    }
 76  0 list = item.listMediators();
 77  0 if (list.size() > 0) {
 78  0 inUsesMediators(item);
 79  0 onUsedMediators(list);
 80  0 outUsesMediators(item);
 81    }
 82   
 83  0 outTopEntity(item);
 84    }
 85   
 86  0 public void inTopEntity(TopEntity item) {
 87  0 if (item.getIdentifier() instanceof IRI == false) {
 88  0 throw new RuntimeException("Cannot serialize " +
 89    item.getClass() + " identified not by IRI!");
 90    }
 91    }
 92  0 public void outTopEntity(TopEntity item) { }
 93   
 94  0 public void inImportsOntologies(TopEntity item) { }
 95  0 public void outImportsOntologies(TopEntity item) { }
 96  0 public void onImportedOntologies(Set list) { }
 97   
 98  0 public void inUsesMediators(TopEntity item) { }
 99  0 public void outUsesMediators(TopEntity item) { }
 100  0 public void onUsedMediators(Set list) { }
 101   
 102  0 public void visit(Ontology item) {
 103  0 inOntology(item);
 104  0 visit((TopEntity)item);
 105  0 Iterator items = null;
 106    // dump axioms
 107  0 items = item.listAxioms().iterator();
 108  0 while (items.hasNext()) {
 109  0 new WSMLItem((Entity)items.next()).apply(this);
 110    }
 111    // dump concepts
 112  0 items = item.listConcepts().iterator();
 113  0 while (items.hasNext()) {
 114  0 new WSMLItem((Entity)items.next()).apply(this);
 115    }
 116    // dump relations
 117  0 items = item.listRelations().iterator();
 118  0 while (items.hasNext()) {
 119  0 Entity relItem = (Entity)items.next();
 120  0 new WSMLItem(relItem).apply(this);
 121    }
 122    // dump instances
 123  0 items = item.listInstances().iterator();
 124  0 while (items.hasNext()) {
 125  0 new WSMLItem((Entity)items.next()).apply(this);
 126    }
 127    // dump relationInstances
 128  0 items = item.listRelationInstances().iterator();
 129  0 while (items.hasNext()) {
 130  0 new WSMLItem((Entity)items.next()).apply(this);
 131    }
 132   
 133  0 outOntology(item);
 134    }
 135   
 136  0 public void visit(Axiom item) {
 137  0 inAxiom(item);
 138  0 onAxiomDefinition(item);
 139  0 outAxiom(item);
 140    }
 141   
 142  0 public void onAxiomDefinition(Axiom item) {
 143  0 visit((Entity)item);
 144  0 Set list = item.listDefinitions();
 145  0 if (list.size() > 0 ) {
 146  0 inLogExpressionDefinition(item);
 147  0 Iterator iter = list.iterator();
 148  0 while (iter.hasNext()) {
 149  0 visit((LogicalExpression)iter.next());
 150    }
 151  0 outLogExpressionDefinition(item);
 152    }
 153    }
 154  0 public void visit(LogicalExpression item) {
 155  0 onLogExpression(item);
 156    }
 157  0 public void onLogExpression(LogicalExpression item) { }
 158  0 public void inLogExpressionDefinition(Axiom item) { }
 159  0 public void outLogExpressionDefinition(Axiom item) { }
 160   
 161  0 public void visit(Concept item) {
 162  0 inConcept(item);
 163  0 Set list = item.listSuperConcepts();
 164  0 if (list.size() > 0) {
 165  0 onSuperConcepts(list);
 166    }
 167  0 visit((Entity)item);
 168  0 list = item.listAttributes();
 169  0 if (list.size() > 0) {
 170  0 Iterator iter = list.iterator();
 171  0 while (iter.hasNext()) {
 172  0 new WSMLItem((Entity)iter.next()).apply(this);
 173    }
 174    }
 175  0 outConcept(item);
 176    }
 177  0 public void onSuperConcepts(Set superconcepts) { }
 178  0 public void visit(Attribute item) {
 179  0 inAttribute(item);
 180  0 visit((Entity)item);
 181  0 outAttribute(item);
 182    }
 183  0 public void inAttribute(Attribute item) { }
 184  0 public void outAttribute(Attribute item) { }
 185   
 186  0 public void visit(Relation item) {
 187  0 inRelation(item);
 188  0 List aList = item.listParameters();
 189  0 if (aList.size() > 0) {
 190  0 onParameters(aList);
 191    }
 192  0 Set list = item.listSuperRelations();
 193  0 if (list.size() > 0) {
 194  0 onSuperRelations(list);
 195    }
 196  0 visit((Entity)item);
 197  0 outRelation(item);
 198    }
 199  0 public void onSuperRelations(Set list) { }
 200   
 201  0 public void onParameters(List list) { }
 202   
 203  0 public void visit(Instance item) {
 204  0 inInstance(item);
 205  0 Set list = item.listConcepts();
 206  0 onInstanceMemberOf(list);
 207   
 208  0 visit((Entity)item);
 209  0 Map map = item.listAttributeValues();
 210  0 Iterator iter = map.entrySet().iterator();
 211  0 while (iter.hasNext()) {
 212  0 Map.Entry e = (Map.Entry)iter.next();
 213  0 Identifier key = (Identifier)e.getKey();
 214  0 Set val = (Set)e.getValue();
 215  0 onAttributeKeyValue(key, val);
 216    }
 217  0 outInstance(item);
 218    }
 219  0 public void onInstanceMemberOf(Set list) { }
 220  0 public void onAttributeKeyValue(Identifier key, Set values) { }
 221   
 222  0 public void visit(RelationInstance item) {
 223  0 inRelationInstance(item);
 224  0 onRelationInstanceMemberOf(item.getRelation());
 225  0 List values = item.listParameterValues();
 226  0 onParameterValues(values);
 227  0 visit((Entity)item);
 228  0 outRelationInstance(item);
 229    }
 230  0 public void onRelationInstanceMemberOf(Relation concept) { }
 231  0 public void onParameterValues(List values) { }
 232   
 233  0 public void visit(ServiceDescription item) {
 234  0 visit((TopEntity)item);
 235  0 Capability capability = item.getCapability();
 236  0 if (capability != null)
 237  0 new WSMLItem(capability).apply(this);
 238  0 Set list = item.listInterfaces();
 239  0 if (list.size()> 0) {
 240  0 if (!USE_MULTIPLE_INTERFACE_LIST || list.size() == 1) {
 241  0 for (Iterator i = list.iterator(); i.hasNext();) {
 242  0 new WSMLItem((Entity) i.next()).apply(this);
 243    }
 244    }
 245    else {
 246  0 onMultipleInterfaces(list);
 247    }
 248    }
 249    }
 250  0 public void onMultipleInterfaces(Set list) {
 251    }
 252   
 253  0 public void onSharedVariables(Set list) {
 254    }
 255   
 256  0 public void visit(Capability item) {
 257  0 inCapability(item);
 258  0 visit((TopEntity)item);
 259  0 Set list = null;
 260  0 list = item.listSharedVariables();
 261  0 if (list.size() > 0) {
 262  0 onSharedVariables(list);
 263    }
 264   
 265  0 list = item.listAssumptions();
 266  0 if (list.size() > 0) {
 267  0 Iterator iter = list.iterator();
 268  0 while (iter.hasNext()) {
 269  0 Axiom ax = (Axiom)iter.next();
 270  0 onHasAssumptions(ax);
 271  0 onAxiomDefinition(ax);
 272    }
 273    }
 274  0 list = item.listEffects();
 275  0 if (list.size() > 0) {
 276  0 Iterator iter = list.iterator();
 277  0 while (iter.hasNext()) {
 278  0 Axiom ax = (Axiom)iter.next();
 279  0 onHasEffects(ax);
 280  0 onAxiomDefinition(ax);
 281    }
 282    }
 283  0 list = item.listPreConditions();
 284  0 if (list.size() > 0) {
 285  0 Iterator iter = list.iterator();
 286  0 while (iter.hasNext()) {
 287  0 Axiom ax = (Axiom)iter.next();
 288  0 onHasPreconditions(ax);
 289  0 onAxiomDefinition(ax);
 290    }
 291    }
 292  0 list = item.listPostConditions();
 293  0 if (list.size() > 0) {
 294  0 Iterator iter = list.iterator();
 295  0 while (iter.hasNext()) {
 296  0 Axiom ax = (Axiom)iter.next();
 297  0 onHasPostconditions(ax);
 298  0 onAxiomDefinition(ax);
 299    }
 300    }
 301  0 outCapability(item);
 302    }
 303  0 public void onHasAssumptions(Entity item) { }
 304  0 public void onHasEffects(Entity item) { }
 305  0 public void onHasPreconditions(Entity item) { }
 306  0 public void onHasPostconditions(Entity item) { }
 307   
 308  0 public void visit(Interface item) {
 309  0 inInterface(item);
 310  0 visit((TopEntity)item);
 311  0 if (item.getChoreography() != null)
 312  0 new WSMLItem(item.getChoreography()).apply(this);
 313  0 if (item.getOrchestration() != null)
 314  0 new WSMLItem(item.getOrchestration()).apply(this);
 315  0 outInterface(item);
 316    }
 317  0 public void visit(Orchestration item) {
 318  0 inOrchestration(item);
 319  0 visit((Entity)item);
 320  0 outOrchestration(item);
 321    }
 322  0 public void visit(Choreography item) {
 323  0 inChoreography(item);
 324  0 visit((Entity)item);
 325  0 outChoreography(item);
 326    }
 327   
 328  0 public void visit(WebService item) {
 329  0 inWebService(item);
 330  0 visit((ServiceDescription)item);
 331  0 outWebService(item);
 332    }
 333   
 334  0 public void visit(Goal item) {
 335  0 inGoal(item);
 336  0 visit((ServiceDescription)item);
 337  0 outGoal(item);
 338    }
 339   
 340  0 public void visit(Mediator item) {
 341  0 visit((TopEntity)item);
 342  0 Set list = item.listSources();
 343  0 if (list.size() > 0) {
 344  0 onMediatorSources(list);
 345    }
 346  0 if (item.getTarget() != null)
 347  0 onMediatorTarget((Identifier)item.getTarget());
 348  0 if (item.getMediationService() != null)
 349  0 onMediatorUseService(item.getMediationService());
 350    }
 351  0 public void visit(OOMediator item) {
 352  0 inOOMediator(item);
 353  0 visit((Mediator)item);
 354  0 outOOMediator(item);
 355    }
 356  0 public void visit(WGMediator item) {
 357  0 inWGMediator(item);
 358  0 visit((Mediator)item);
 359  0 outWGMediator(item);
 360    }
 361  0 public void visit(WWMediator item) {
 362  0 inWWMediator(item);
 363  0 visit((Mediator)item);
 364  0 outWWMediator(item);
 365    }
 366  0 public void visit(GGMediator item) {
 367  0 inGGMediator(item);
 368  0 visit((Mediator)item);
 369  0 outGGMediator(item);
 370    }
 371    // ------------------ complete ---
 372  0 public void inOntology(Ontology item) {
 373    }
 374  0 public void inAxiom(Axiom item) {
 375    }
 376  0 public void inConcept(Concept item) {
 377    }
 378  0 public void inRelation(Relation item) {
 379    }
 380  0 public void inInstance(Instance item) {
 381    }
 382  0 public void inRelationInstance(RelationInstance item) {
 383    }
 384   
 385  0 public void inWebService(WebService item) {
 386    }
 387  0 public void inCapability(Capability item) {
 388    }
 389  0 public void inInterface(Interface item) {
 390    }
 391  0 public void inOrchestration(Orchestration item) {
 392    }
 393  0 public void inChoreography(Choreography item) {
 394    }
 395   
 396  0 public void inGoal(Goal item) {
 397    }
 398   
 399  0 public void inOOMediator(OOMediator item) {
 400    }
 401  0 public void inWGMediator(WGMediator item) {
 402    }
 403  0 public void inWWMediator(WWMediator item) {
 404    }
 405  0 public void inGGMediator(GGMediator item) {
 406    }
 407   
 408  0 public void onMediatorSources(Set item) {
 409    }
 410  0 public void onMediatorTarget(Identifier item) {
 411    }
 412  0 public void onMediatorUseService(Identifier item) {
 413    }
 414   
 415  0 public void outOntology(Ontology item) {
 416    }
 417  0 public void outAxiom(Axiom item) {
 418    }
 419  0 public void outConcept(Concept item) {
 420    }
 421  0 public void outRelation(Relation item) {
 422    }
 423  0 public void outInstance(Instance item) {
 424    }
 425  0 public void outRelationInstance(RelationInstance item) {
 426    }
 427   
 428  0 public void outWebService(WebService item) {
 429    }
 430  0 public void outCapability(Capability item) {
 431    }
 432  0 public void outInterface(Interface item) {
 433    }
 434  0 public void outOrchestration(Orchestration item) {
 435    }
 436  0 public void outChoreography(Choreography item) {
 437    }
 438   
 439  0 public void outGoal(Goal item) {
 440    }
 441   
 442  0 public void outOOMediator(OOMediator item) {
 443    }
 444  0 public void outWGMediator(WGMediator item) {
 445    }
 446  0 public void outWWMediator(WWMediator item) {
 447    }
 448  0 public void outGGMediator(GGMediator item) {
 449    }
 450   
 451    }
 452   
 453    /*
 454    * $Log$
 455    * Revision 1.6 2006/03/29 08:51:57 vassil_momtchev
 456    * mediator reference source/target by IRI (changed from TopEntity); mediator reference mediationService by IRI (changed from Identifier)
 457    *
 458    * Revision 1.5 2006/03/06 15:22:40 vassil_momtchev
 459    * when multiple interfaces used in a webservice, serialize the full interface data instead of minterfaces = 'interface' '{' id moreids* '}' reference construction
 460    *
 461    * Revision 1.4 2006/02/13 10:42:36 vassil_momtchev
 462    * throw exception if topentity identified by anonId (created by another impl) serialized
 463    *
 464    * Revision 1.3 2006/02/10 14:39:49 vassil_momtchev
 465    * serializer addapted to the new api changes
 466    *
 467    * Revision 1.2 2005/11/28 14:51:37 vassil_momtchev
 468    * moved from com.ontotext.wsmo4j.parser
 469    *
 470    * Revision 1.1.2.1 2005/11/28 13:59:35 vassil_momtchev
 471    * package refactored from com.ontotext.wsmo4j.parser to com.ontotext.wsmo4j.serializer.wsml
 472    *
 473    * Revision 1.3.2.1 2005/11/21 17:38:36 holgerlausen
 474    * added more logexp support
 475    *
 476    * Revision 1.3 2005/09/02 13:32:45 ohamano
 477    * move logicalexpression packages from ext to core
 478    * move tests from logicalexpression.test to test module
 479    *
 480    * Revision 1.2 2005/07/05 12:45:51 alex_simov
 481    * attributes refactored
 482    *
 483    * Revision 1.1 2005/06/27 08:32:00 alex_simov
 484    * refactoring: *.io.parser -> *.parser
 485    *
 486    * Revision 1.12 2005/06/22 15:53:36 alex_simov
 487    * capability parse bug fix
 488    *
 489    * Revision 1.11 2005/06/22 14:49:27 alex_simov
 490    * Copyright header added/updated
 491    *
 492    * Revision 1.10 2005/06/02 14:19:19 alex_simov
 493    * v0.4.0
 494    *
 495    * Revision 1.2 2005/06/02 12:33:09 damian
 496    * fixes
 497    *
 498    * Revision 1.1 2005/05/26 09:36:03 damian
 499    * io package
 500    *
 501    * Revision 1.9 2005/03/02 10:56:41 morcen
 502    * fixed bugs 1154273, 1154263, 1154190 with the serializers
 503    *
 504    * Revision 1.8 2005/01/25 14:03:55 alex_simov
 505    * Refactoring:
 506    * 1. Instance: getMemberOf()/setMemberOf() replaced by getConcept()/setConcept()
 507    * 2. RelationInstance: getInstanceOf()/setInstanceOf() replaced by getRelation()/setRelation()
 508    *
 509    * Revision 1.7 2005/01/12 15:20:18 alex_simov
 510    * checkstyle formatting
 511    *
 512    */