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

import de.uni_stuttgart.vis.vowl.owl2vowl.model.data.VowlData;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.classes.AbstractClass;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.classes.VowlClass;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.datatypes.VowlDatatype;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.nodes.datatypes.VowlLiteral;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.properties.VowlDatatypeProperty;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.entities.properties.VowlObjectProperty;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.util.OWLObjectVisitorAdapter;

public class EntityCreationVisitor extends OWLObjectVisitorAdapter {

	private VowlData vowlData;

	public EntityCreationVisitor(VowlData vowlData) {
		this.vowlData = vowlData;
	}

	@Override
	public void visit(OWLClass ce) {
		AbstractClass clazz = null;

		if (ce.isOWLThing() || ce.isOWLNothing()) {
			// General class do not create here
			return;
		} else if (!ce.isAnonymous()) {
			clazz = new VowlClass(ce.getIRI());
		} else {
			// TODO Anonymous behaviour undefined
		}

		vowlData.addClass(clazz);
	}

	@Override
	public void visit(OWLLiteral node) {
	}

	@Override
	public void visit(OWLDatatype node) {
		if (node.getIRI().toString().equals(VowlLiteral.LITERAL_IRI)) {
			// Skip generic literal. Already included in the data as default.
			return;
		}

		vowlData.addDatatype(new VowlDatatype(node.getIRI()));
	}

	@Override
	public void visit(OWLObjectProperty property) {
		VowlObjectProperty prop = null;

		if(!property.isAnonymous()) {
			prop = new VowlObjectProperty(property.getIRI());
		} else {
			// TODO anonymous behaviour
		}

		vowlData.addObjectProperty(prop);
	}

	@Override
	public void visit(OWLDataProperty property) {
		VowlDatatypeProperty prop = null;

		if(!property.isAnonymous()) {
			prop = new VowlDatatypeProperty(property.getIRI());
		} else {
			// TODO anonymous behaviour
		}

		vowlData.addDatatypeProperty(prop);
	}
}

@@ -982,25 +982,18 @@
 ss clazz
- = null
 ;%0A
+
 %0A%09%09if (c
@@ -1206,16 +1206,27 @@
 defined%0A
+%09%09%09return;%0A
 %09%09%7D%0A%0A%09%09v
@@ -1646,39 +1646,32 @@
 ectProperty prop
- = null
 ;%0A%0A%09%09if(!propert
@@ -1776,32 +1776,43 @@
 ymous behaviour%0A
+%09%09%09return;%0A
 %09%09%7D%0A%0A%09%09vowlData.
@@ -1929,15 +1929,8 @@
 prop
- = null
 ;%0A%0A%09
@@ -2018,32 +2018,32 @@
 ());%0A%09%09%7D else %7B%0A
-
 %09%09%09// TODO anony
@@ -2057,16 +2057,27 @@
 haviour%0A
+%09%09%09return;%0A
 %09%09%7D%0A%0A%09%09v

Clean up code.