All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.coode.oppl.entity.OWLEntityRendererImpl Maven / Gradle / Ivy

package org.coode.oppl.entity;

import org.semanticweb.owlapi.model.OWLEntity;

/** @author Luigi Iannone */
public class OWLEntityRendererImpl implements OWLEntityRenderer {
    @Override
    public String render(OWLEntity entity) {
        try {
            String rendering = entity.getIRI().getFragment();
            if (rendering == null) {
                // Get last bit of path
                String path = entity.getIRI().toURI().getPath();
                if (path == null) {
                    return entity.getIRI().toString();
                }
                return entity.getIRI().toURI().getPath()
                        .substring(path.lastIndexOf("/") + 1);
            }
            return RenderingEscapeUtils.getEscapedRendering(rendering);
        } catch (Exception e) {
            return "";
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy