/*
 * ClassParser.java
 *
 */

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

import de.uni_stuttgart.vis.vowl.owl2vowl.model.Constants;
import de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.classes.BaseClass;
import de.uni_stuttgart.vis.vowl.owl2vowl.pipes.FormatText;
import org.semanticweb.owlapi.model.OWLAnnotation;
import org.semanticweb.owlapi.model.OWLClass;

import java.util.Map;
import java.util.Set;

/**
 *
 */
public class ClassParser extends GeneralNodeParser {
	private Set<OWLClass> classes;

	public ClassParser(Set<OWLClass> classes) {
		this.classes = classes;
	}

	protected void execute() {
		Map<String, BaseClass> classMap = mapData.getClassMap();
		Map<String, OWLClass> owlClasses = mapData.getOwlClasses();

		int indexCounter = classMap.size();

		for (OWLClass currentClass : classes) {
			rdfsLabel = "";
			rdfsComment = "";
			isDeprecated = false;
			rdfsIsDefinedBy = "";
			owlVersionInfo = "";
			iri = currentClass.getIRI().toString();

			// If thing is found skip it! It only gets created where necessary.
			if (iri.equals(Constants.OWL_THING_CLASS_URI)) {
				continue;
			}

			Set<OWLAnnotation> currentClassAnnotations = currentClass.getAnnotations(GeneralParser.ontology);

			TypeFinder finder = new TypeFinder(GeneralParser.ontology, GeneralParser.factory);
			BaseClass theClass = finder.findVowlClass(currentClass);

			parseAnnotations(currentClassAnnotations);

			if (rdfsLabel.isEmpty()) {
				rdfsLabel = extractNameFromIRI(iri);
			}


			// Setting data in VOWLClass
			theClass.setName(FormatText.cutQuote(rdfsLabel));
			theClass.setComment(FormatText.cutQuote(rdfsComment));
			theClass.setIri(iri);
			theClass.setDefinedBy(FormatText.cutQuote(rdfsIsDefinedBy));
			theClass.setOwlVersion(FormatText.cutQuote(owlVersionInfo));

			if (isDeprecated) {
				theClass.getAttributes().add(Constants.TYPE_DEPRECTAEDCLASS);
			}

			owlClasses.put(currentClass.getIRI().toString(), currentClass);
			classMap.put(theClass.getIri(), theClass);

			indexCounter++;
		}
	}
}

@@ -358,21 +358,123 @@
 odel.OWL
-Class
+Axiom;%0Aimport org.semanticweb.owlapi.model.OWLClass;%0Aimport org.semanticweb.owlapi.model.OWLClassExpression
 ;%0A%0Aimpor
@@ -1217,16 +1217,335 @@
 ;%0A%09%09%09%7D%0A%0A
+%09%09%09Main.logger.info(%22Class: %22 + currentClass);%0A%09%09%09for(OWLAxiom currentAxiom : currentClass.getReferencingAxioms(ontology))%7B%0A%09%09%09%09Main.logger.info(%22%5CtAxiom: %22 + currentAxiom);%0A%0A%09%09%09%09for(OWLClassExpression nestExpr : currentAxiom.getNestedClassExpressions()) %7B%0A%09%09%09%09%09Main.logger.info(%22%5Ct%5CtNested: %22 + nestExpr);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%0A
 %09%09%09Set%3CO

Add logging to classes.