edu.stanford.protege.webprotege.crud.supplied.SuppliedNameSuffixKit Maven / Gradle / Ivy
package edu.stanford.protege.webprotege.crud.supplied;
import com.fasterxml.jackson.annotation.JsonTypeName;
import edu.stanford.protege.webprotege.crud.EntityCrudKit;
import edu.stanford.protege.webprotege.crud.EntityCrudKitId;
import edu.stanford.protege.webprotege.crud.EntityCrudKitPrefixSettings;
import edu.stanford.protege.webprotege.crud.gen.GeneratedAnnotationsSettings;
import org.semanticweb.owlapi.model.IRI;
import javax.inject.Inject;
import java.util.Optional;
/**
* Author: Matthew Horridge
* Stanford University
* Bio-Medical Informatics Research Group
* Date: 14/08/2013
*/
@JsonTypeName("SuppliedName")
public class SuppliedNameSuffixKit extends EntityCrudKit {
private static final EntityCrudKitId ID = EntityCrudKitId.get("SuppliedNameSuffix");
@Inject
public SuppliedNameSuffixKit() {
super(ID, "Supplied name");
}
public static EntityCrudKitId getId() {
return ID;
}
@Override
public EntityCrudKitPrefixSettings getDefaultPrefixSettings() {
return EntityCrudKitPrefixSettings.get();
}
@Override
public SuppliedNameSuffixSettings getDefaultSuffixSettings() {
return SuppliedNameSuffixSettings.get();
}
@Override
public Optional getPrefixValidationMessage(String prefix) {
if(!(prefix.endsWith("#") || prefix.endsWith("/"))) {
return Optional.of("It is recommended that your prefix ends with a forward slash i.e. / (or a #)");
}
else {
return Optional.empty();
}
}
@Override
public IRI generateExample(EntityCrudKitPrefixSettings prefixSettings, SuppliedNameSuffixSettings suffixSettings) {
return IRI.create(prefixSettings.getIRIPrefix(), "Person");
}
@Override
public GeneratedAnnotationsSettings getDefaultGeneratedAnnotationsSettings() {
return GeneratedAnnotationsSettings.empty();
}
}