/*
 * VowlClassVisitor.java
 *
 */

package de.uni_stuttgart.vis.vowl.owl2vowl.parser.vowl;

import de.uni_stuttgart.vis.vowl.owl2vowl.constants.VowlAttribute;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.data.VowlData;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.AbstractNode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLObjectIntersectionOf;
import org.semanticweb.owlapi.util.OWLClassExpressionVisitorAdapter;

import java.util.Set;

/**
 *
 */
public class VowlClassVisitor extends OWLClassExpressionVisitorAdapter {
	private final VowlData vowlData;
	private final OWLClass referencedClass;
	Logger logger = LogManager.getLogger(VowlClassVisitor.class);

	public VowlClassVisitor(VowlData vowlData, OWLClass referencedClass) {
		this.vowlData = vowlData;
		this.referencedClass = referencedClass;
	}

	@Override
	protected void handleDefault(OWLClassExpression c) {
		System.out.println("Not implemented VowlClassVisitor: " + c);
		logger.info("Not implemented for equivalents: " + c);
	}

	@Override
	public void visit(OWLObjectIntersectionOf ce) {
		Set<OWLClassExpression> operands = ce.getOperands();

		AbstractNode node = vowlData.getClassForIri(referencedClass.getIRI());

		for (OWLClassExpression operand : operands) {
			if (!operand.isAnonymous()) {
				node.addElementToIntersection(operand.asOWLClass().getIRI());
				node.addAttribute(VowlAttribute.INTERSECTION);
			} else {
				// TODO Anonymous undefined behaviour
				logger.info("Anonymous exists in intersections.");
			}
		}
	}
}

@@ -408,133 +408,9 @@
 del.
-OWLClass;%0Aimport org.semanticweb.owlapi.model.OWLClassExpression;%0Aimport org.semanticweb.owlapi.model.OWLObjectIntersectionOf
+*
 ;%0Aim
@@ -998,16 +998,16 @@
 %22 + c);%0A
-
 %09%09logger
@@ -1054,24 +1054,691 @@
 %22 + c);%0A%09%7D%0A%0A
+%09@Override%0A%09public void visit(OWLObjectUnionOf ce) %7B%0A%09%09System.out.println(%22Not implemented OWLObjectUnionOf: %22 + ce);%0A%09%09logger.info(%22Not implemented for OWLObjectUnionOf: %22 + ce);%0A%09%7D%0A%0A%09@Override%0A%09public void visit(OWLObjectComplementOf ce) %7B%0A%09%09if (ce.getOperand().isAnonymous()) %7B%0A%09%09%09logger.info(%22Anonymous operand in object complement of.%22);%0A%09%09%09return;%0A%09%09%7D%0A%0A%09%09vowlData.getClassForIri(ce.getOperand().asOWLClass().getIRI()).setComplement(referencedClass.getIRI());%0A%09%09vowlData.getClassForIri(referencedClass.getIRI()).setComplement(ce.getOperand().asOWLClass().getIRI());%0A%09%09vowlData.getClassForIri(referencedClass.getIRI()).addAttribute(VowlAttribute.COMPLEMENT);%0A%09%7D%0A%0A
 %09@Override%0A%09

Implement object complement of