001 package nl.tudelft.tbm.eeni.owl2java.model.jmodel.utils;
002
003 import com.hp.hpl.jena.ontology.OntResource;
004 import nl.tudelft.tbm.eeni.owl2java.model.jmodel.JBaseRestriction;
005 import nl.tudelft.tbm.eeni.owl2java.model.jmodel.JClass;
006 import nl.tudelft.tbm.eeni.owl2java.model.jmodel.JProperty;
007
008
009 public class LogUtils {
010
011 public static String toLogName(JBaseRestriction restriction) {
012 return "Restriction " + LogUtils.toLogName(restriction.getOnClass(), restriction.getOnProperty());
013 }
014
015 public static String toLogName(JClass cls) {
016 return cls.getJavaPackageName() + "." + cls.getName();
017 }
018
019 public static String toLogName(JClass cls, JProperty property) {
020 return toLogName(cls) + "->" + LogUtils.toLogName(property);
021 }
022
023 public static String toLogName(JProperty prop) {
024 return prop.getName();
025 }
026
027 public static String toLogName(OntResource res) {
028 String ns = res.getNameSpace();
029 if (res.getModel().getNsURIPrefix(ns) != null) {
030 return res.getModel().getNsURIPrefix(res.getNameSpace()) + "#" + res.getLocalName();
031 }
032 return ns + res.getLocalName();
033 }
034
035 }