src/main/java/de/unirostock/sems/bives/cellml/algorithm/CellMLGraphProducer.java
protected void processRnA () throws BivesUnsupportedException
	{
		LOGGER.info ("init compartment");
		CellMLModel modelA = cellmlDocA.getModel ();
		//LOGGER.info ("setup compartment in A: " + wholeCompartment + " - " + modelA);
		wholeCompartment.setDocA (modelA.getDocumentNode ());
		//LOGGER.info ("setting compartment");
		rn.setCompartment (modelA.getDocumentNode (), wholeCompartment);

		
		LOGGER.info ("looping through components in A");
		HashMap<String, CellMLComponent> components = modelA.getComponents ();
		for (CellMLComponent component : components.values ())
		{
			List<CellMLReaction> reactions = component.getReactions ();
			for (CellMLReaction reaction : reactions)
			{
				ReactionNetworkReaction rnReaction = new ReactionNetworkReaction (rn, reaction.getComponent ().getName (), null, reaction.getDocumentNode (), null, wholeCompartment, null, reaction.isReversible ());
				rn.setReaction (reaction.getDocumentNode (), rnReaction);
				List<CellMLReactionSubstance> substances = reaction.getSubstances ();
				for (CellMLReactionSubstance substance : substances)
				{
					boolean addSubstance = false;
					CellMLVariable var = substance.getVariable ();
					CellMLVariable rootvar = var.getRootVariable ();
					List<CellMLReactionSubstance.Role> roles = substance.getRoles ();
					ReactionNetworkSubstance subst = rn.getSubstance (rootvar.getDocumentNode ());
					// substance undefined?
					if (subst == null)
					{
						subst = new ReactionNetworkSubstance (rn, rootvar.getName (), null, rootvar.getDocumentNode (), null, wholeCompartment, null);
						addSubstance = true;
					}
					// set up of reaction
					for (CellMLReactionSubstance.Role role : roles)
					{
						switch (role.role)
						{
							case CellMLReactionSubstance.ROLE_REACTANT:
								rnReaction.addInputA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_PRODUCT:
								rnReaction.addOutputA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_MODIFIER:
								rnReaction.addModA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_ACTIVATOR:
							case CellMLReactionSubstance.ROLE_CATALYST:
								rnReaction.addModA (subst, SBOTerm.createStimulator (), null);
								break;
							case CellMLReactionSubstance.ROLE_INHIBITOR:
								rnReaction.addModA (subst, SBOTerm.createInhibitor (), null);
								break;
							case CellMLReactionSubstance.ROLE_RATE:
								continue;
						}
						if (addSubstance)
						{
							rn.setSubstance (rootvar.getDocumentNode (), subst);
							addSubstance = false;
						}
					}
				}
			}
		}
	}
/**
	 * Process Reaction Network of the original document.
	 * @throws BivesUnsupportedException 
	 */
Process Reaction Network of the original document.
Process Reaction Network of the original document .
protected void processRnA () throws BivesUnsupportedException
	{
		LOGGER.info ("init compartment");
		CellMLModel modelA = cellmlDocA.getModel ();
		wholeCompartment.setDocA (modelA.getDocumentNode ());
		rn.setCompartment (modelA.getDocumentNode (), wholeCompartment);
		LOGGER.info ("looping through components in A");
		HashMap<String, CellMLComponent> components = modelA.getComponents ();
		for (CellMLComponent component : components.values ())
		{
			List<CellMLReaction> reactions = component.getReactions ();
			for (CellMLReaction reaction : reactions)
			{
				ReactionNetworkReaction rnReaction = new ReactionNetworkReaction (rn, reaction.getComponent ().getName (), null, reaction.getDocumentNode (), null, wholeCompartment, null, reaction.isReversible ());
				rn.setReaction (reaction.getDocumentNode (), rnReaction);
				List<CellMLReactionSubstance> substances = reaction.getSubstances ();
				for (CellMLReactionSubstance substance : substances)
				{
					boolean addSubstance = false;
					CellMLVariable var = substance.getVariable ();
					CellMLVariable rootvar = var.getRootVariable ();
					List<CellMLReactionSubstance.Role> roles = substance.getRoles ();
					ReactionNetworkSubstance subst = rn.getSubstance (rootvar.getDocumentNode ());
					if (subst == null)
					{
						subst = new ReactionNetworkSubstance (rn, rootvar.getName (), null, rootvar.getDocumentNode (), null, wholeCompartment, null);
						addSubstance = true;
					}
					for (CellMLReactionSubstance.Role role : roles)
					{
						switch (role.role)
						{
							case CellMLReactionSubstance.ROLE_REACTANT:
								rnReaction.addInputA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_PRODUCT:
								rnReaction.addOutputA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_MODIFIER:
								rnReaction.addModA (subst, null, null);
								break;
							case CellMLReactionSubstance.ROLE_ACTIVATOR:
							case CellMLReactionSubstance.ROLE_CATALYST:
								rnReaction.addModA (subst, SBOTerm.createStimulator (), null);
								break;
							case CellMLReactionSubstance.ROLE_INHIBITOR:
								rnReaction.addModA (subst, SBOTerm.createInhibitor (), null);
								break;
							case CellMLReactionSubstance.ROLE_RATE:
								continue;
						}
						if (addSubstance)
						{
							rn.setSubstance (rootvar.getDocumentNode (), subst);
							addSubstance = false;
						}
					}
				}
			}
		}
	}
protected void processRnA ( ) throws BivesUnsupportedException { LOGGER . info ( "init compartment" ) ; CellMLModel modelA = cellmlDocA . getModel ( ) ; wholeCompartment . setDocA ( modelA . getDocumentNode ( ) ) ; rn . setCompartment ( modelA . getDocumentNode ( ) , wholeCompartment ) ; LOGGER . info ( "looping through components in A" ) ; HashMap < String , CellMLComponent > components = modelA . getComponents ( ) ; for ( CellMLComponent component : components . values ( ) ) { List < CellMLReaction > reactions = component . getReactions ( ) ; for ( CellMLReaction reaction : reactions ) { ReactionNetworkReaction rnReaction = new ReactionNetworkReaction ( rn , reaction . getComponent ( ) . getName ( ) , null , reaction . getDocumentNode ( ) , null , wholeCompartment , null , reaction . isReversible ( ) ) ; rn . setReaction ( reaction . getDocumentNode ( ) , rnReaction ) ; List < CellMLReactionSubstance > substances = reaction . getSubstances ( ) ; for ( CellMLReactionSubstance substance : substances ) { boolean addSubstance = false ; CellMLVariable var = substance . getVariable ( ) ; CellMLVariable rootvar = var . getRootVariable ( ) ; List < CellMLReactionSubstance . Role > roles = substance . getRoles ( ) ; ReactionNetworkSubstance subst = rn . getSubstance ( rootvar . getDocumentNode ( ) ) ; if ( subst == null ) { subst = new ReactionNetworkSubstance ( rn , rootvar . getName ( ) , null , rootvar . getDocumentNode ( ) , null , wholeCompartment , null ) ; addSubstance = true ; } for ( CellMLReactionSubstance . Role role : roles ) { switch ( role . role ) { case CellMLReactionSubstance . ROLE_REACTANT : rnReaction . addInputA ( subst , null , null ) ; break ; case CellMLReactionSubstance . ROLE_PRODUCT : rnReaction . addOutputA ( subst , null , null ) ; break ; case CellMLReactionSubstance . ROLE_MODIFIER : rnReaction . addModA ( subst , null , null ) ; break ; case CellMLReactionSubstance . ROLE_ACTIVATOR : case CellMLReactionSubstance . ROLE_CATALYST : rnReaction . addModA ( subst , SBOTerm . createStimulator ( ) , null ) ; break ; case CellMLReactionSubstance . ROLE_INHIBITOR : rnReaction . addModA ( subst , SBOTerm . createInhibitor ( ) , null ) ; break ; case CellMLReactionSubstance . ROLE_RATE : continue ; } if ( addSubstance ) { rn . setSubstance ( rootvar . getDocumentNode ( ) , subst ) ; addSubstance = false ; } } } } } }
Process Reaction Network of the original document.
Process Reaction Network of the original document .
//LOGGER.info ("setup compartment in A: " + wholeCompartment + " - " + modelA); //LOGGER.info ("setting compartment"); // substance undefined? // set up of reaction