org.protege.editor.owl.ui.clsdescriptioneditor.OWLObjectPropertySetChecker Maven / Gradle / Ivy
The newest version!
package org.protege.editor.owl.ui.clsdescriptioneditor;
import org.protege.editor.owl.model.OWLModelManager;
import org.protege.editor.owl.model.classexpression.OWLExpressionParserException;
import org.protege.editor.owl.model.parser.ParserUtil;
import org.protege.editor.owl.model.parser.ProtegeOWLEntityChecker;
import org.semanticweb.owlapi.manchestersyntax.parser.ManchesterOWLSyntaxParserImpl;
import org.semanticweb.owlapi.manchestersyntax.renderer.ParserException;
import org.semanticweb.owlapi.model.OWLObjectPropertyExpression;
import org.semanticweb.owlapi.model.OWLOntologyLoaderConfiguration;
import org.semanticweb.owlapi.util.mansyntax.ManchesterOWLSyntaxParser;
import java.util.Set;
/**
* Author: Matthew Horridge
* The University Of Manchester
* Bio-Health Informatics Group
* Date: 22-Feb-2007
*
*/
class OWLObjectPropertySetChecker implements OWLExpressionChecker> {
private OWLModelManager mngr;
public OWLObjectPropertySetChecker(OWLModelManager mngr) {
this.mngr = mngr;
}
public void check(String text) throws OWLExpressionParserException {
createObject(text);
}
public Set createObject(String text) throws OWLExpressionParserException {
ManchesterOWLSyntaxParser parser = new ManchesterOWLSyntaxParserImpl(OWLOntologyLoaderConfiguration::new, mngr.getOWLDataFactory());
parser.setStringToParse(text);
parser.setOWLEntityChecker(new ProtegeOWLEntityChecker(mngr.getOWLEntityFinder()));
try {
return parser.parseObjectPropertyList();
}
catch (ParserException e) {
throw ParserUtil.convertException(e);
}
}
}