Я хочу знать, возможно ли перейти от выражения, подобного этому:
EquivalentClasses(<http://owl.man.ac.uk/2006/07/sssw/people#vegetarian> ObjectIntersectionOf(<http://owl.man.ac.uk/2006/07/sssw/people#animal> ObjectAllValuesFrom(<http://owl.man.ac.uk/2006/07/sssw/people#eats> ObjectComplementOf(<http://owl.man.ac.uk/2006/07/sssw/people#animal>)) ObjectAllValuesFrom(<http://owl.man.ac.uk/2006/07/sssw/people#eats> ObjectComplementOf(ObjectSomeValuesFrom(<http://owl.man.ac.uk/2006/07/sssw/people#part_of> <http://owl.man.ac.uk/2006/07/sssw/people#animal>)))) )
, к этому типу выражения, проблема здесь не в том, чтобы сократить IRI, проблема здесь состоит в том, чтобы сделать переводы в«и только ...» с использованием OWLAPI:
animal
and (eats only (not (animal)))
and (eats only (not (part_of some animal)))
Онтология, которую я использую, http://owl.man.ac.uk/2006/07/sssw/people.owl, и метод, в котором я получаю выражение, таков (в данном случае,эквиваленты для вегетарианца):
public static void getEquivalentClasses2() throws OWLOntologyCreationException {
IRI iri = IRI.create("http://owl.man.ac.uk/2006/07/sssw/people.owl");
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLOntology ont = manager.loadOntologyFromOntologyDocument(iri);
System.out.println("Loaded " + ont.getOntologyID());
//OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
//OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
//OWLReasoner reasoner = reasonerFactory.createReasoner(ont, new SimpleConfiguration());
ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor();
OWLReasonerConfiguration config = new SimpleConfiguration(progressMonitor);
OWLReasoner reasoner = reasonerFactory.createReasoner(ont, config);
Set<OWLEquivalentClassesAxiom> setEquivalentes = null;
OWLDataFactory fac = manager.getOWLDataFactory();
OWLClass expr = fac.getOWLClass(IRI.create("http://owl.man.ac.uk/2006/07/sssw/people#vegetarian"));
setEquivalentes = ont.getEquivalentClassesAxioms(expr);
String equi = "";
for(OWLEquivalentClassesAxiom e : setEquivalentes)
{
System.out.println(e);
}
}