public void classifyOntology(OWLOntology ontology, OWLReasonerFactory factory) { ToStringRenderer.getInstance().setRenderer(new ManchesterOWLSyntaxOWLObjectRendererImpl()); OWLReasoner reasoner = factory.createNonBufferingReasoner(ontology); // reasoner.precomputeInferences(InferenceType.values()); long time = System.currentTimeMillis(); boolean isConsistent = reasoner.isConsistent(); int numOfUnsatClasses = reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size(); time = System.currentTimeMillis() - time; DLExpressivityChecker checker = new DLExpressivityChecker(Collections.singleton(ontology)); String e = checker.getDescriptionLogicName(); String name = ontology.getOntologyID().getOntologyIRI().getFragment(); logger.info( "ontology: " + name + ", reasoner: " + factory.getReasonerName() + ", expressivity: " + e + ", consistent: " + isConsistent + ", unsat classes: " + numOfUnsatClasses + ", time: " + time); }
public void add(Set<O> clique) { resultCliques = null; final Set<O> unmodClique = Collections.unmodifiableSet(clique); originalCliques.add(unmodClique); List<O> orderedOperands = new ArrayList<O>(clique); for (int i = 0; i < orderedOperands.size(); i++) { O a = orderedOperands.get(i); for (int j = i + 1; j < orderedOperands.size(); j++) { O b = orderedOperands.get(j); addEdge(a, b); addEdge(b, a); } } }
private AutocompleteResult exceptionToAutocomplete( final String expression, final ParserException e, final OWLEntityFinder finder, final ShortFormProvider sfp) { String lastToken; int pos; if (e.getCurrentToken().endsWith(ERROR_TOKEN)) { lastToken = e.getCurrentToken(); lastToken = lastToken.substring(0, lastToken.length() - ERROR_TOKEN.length()); // remove the $$ pos = e.getStartPos(); } else { lastToken = e.getTokenSequence().get(e.getTokenSequence().size() - 1); if (lastToken.endsWith(ERROR_TOKEN)) { lastToken = lastToken.substring(0, lastToken.length() - ERROR_TOKEN.length()); // remove the $$ } else if (lastToken.equals("<EOF>")) { lastToken = e.getTokenSequence().get(e.getTokenSequence().size() - 2); // EOF is last lastToken = lastToken.substring(0, lastToken.length() - ERROR_TOKEN.length()); // remove the $$ } else if (!expression.endsWith(lastToken)) { // later invalid tokens are not in the list lastToken = expression.substring( expression.lastIndexOf(" ") + 1); // we just have to guess at the last word } pos = expression.length() - lastToken.length(); } Map<String, List<String>> expected = new HashMap<String, List<String>>(); String search = lastToken + ".*"; // starts with if (pos == e.getStartPos()) { // then the error is the last token and we can determine the type if (hasExpectedToken(e)) { final Set<String> keywords = e.getExpectedKeywords(); if (!keywords.isEmpty()) { List<String> matchingKeywords = new ArrayList<String>(); for (String keyword : keywords) { if (lastToken.length() == 0 || keyword.startsWith(lastToken)) { matchingKeywords.add(keyword); } } expected.put("keyword", matchingKeywords); } if (e.isClassNameExpected()) { addResults(expected, OWLClass.class, finder.getOWLClasses(search), sfp); } if (e.isObjectPropertyNameExpected()) { addResults(expected, OWLObjectProperty.class, finder.getOWLObjectProperties(search), sfp); } if (e.isDataPropertyNameExpected()) { addResults(expected, OWLDataProperty.class, finder.getOWLDataProperties(search), sfp); } if (e.isDatatypeNameExpected()) { addResults(expected, OWLDatatype.class, finder.getOWLDatatypes(search), sfp); } if (e.isAnnotationPropertyNameExpected()) { addResults( expected, OWLAnnotationProperty.class, finder.getOWLAnnotationProperties(search), sfp); } if (e.isIndividualNameExpected()) { addResults(expected, OWLNamedIndividual.class, finder.getOWLIndividuals(search), sfp); } } else { expected.put("literal", Collections.<String>emptyList()); } } else { addKeywords(expected, lastToken); addResults(expected, OWLClass.class, finder.getOWLClasses(search), sfp); addResults(expected, OWLObjectProperty.class, finder.getOWLObjectProperties(search), sfp); addResults(expected, OWLDataProperty.class, finder.getOWLDataProperties(search), sfp); addResults(expected, OWLDatatype.class, finder.getOWLDatatypes(search), sfp); addResults( expected, OWLAnnotationProperty.class, finder.getOWLAnnotationProperties(search), sfp); addResults(expected, OWLNamedIndividual.class, finder.getOWLIndividuals(search), sfp); } return new AutocompleteResult(expression, pos, lastToken, expected); }
@Test public void expressivityTest() { OWLOntology ontology = loadBigOntology("mouse"); DLExpressivityChecker checker = new DLExpressivityChecker(Collections.singleton(ontology)); logger.info(checker.getDescriptionLogicName()); }
public Iterator getRelatedObjectsToRemove(Object obj) { return Collections.emptySet().iterator(); }