protected OWLAnnotation parseAnnotation() { OWLAnnotationProperty annoProp = parseAnnotationProperty(); String obj = peekToken(); if (isIndividualName(obj) || isClassName(obj) || isObjectPropertyName(obj) || isDataPropertyName(obj)) { consumeToken(); OWLAnnotationValue value; if (obj.startsWith("_:")) { value = anonProvider.getOWLAnonymousIndividual(obj); } else { value = getIRI(obj); } return df.getOWLAnnotation(annoProp, value); } if (obj.startsWith("<")) { IRI value = parseIRI(); return df.getOWLAnnotation(annoProp, value); } OWLLiteral con = parseLiteral(null); return df.getOWLAnnotation(annoProp, con); }
protected OWLAnnotation parseAnnotation() { OWLAnnotationProperty annoProp = parseAnnotationProperty(); String obj = peekToken(); if (isIndividualName(obj) || isClassName(obj) || isObjectPropertyName(obj) || isDataPropertyName(obj)) { consumeToken(); OWLAnnotationValue value; if (obj.startsWith("_:")) { value = anonProvider.getOWLAnonymousIndividual(obj); } else { value = getIRI(obj); } return df.getOWLAnnotation(annoProp, value); } if (obj.startsWith("<")) { IRI value = parseIRI(); return df.getOWLAnnotation(annoProp, value); } OWLLiteral con = parseLiteral(null); return df.getOWLAnnotation(annoProp, con); }
protected OWLAnnotation parseAnnotation() { OWLAnnotationProperty annoProp = parseAnnotationProperty(); String obj = peekToken(); if (isIndividualName(obj) || isClassName(obj) || isObjectPropertyName(obj) || isDataPropertyName(obj)) { consumeToken(); OWLAnnotationValue value; if (obj.startsWith("_:")) { value = anonProvider.getOWLAnonymousIndividual(obj); } else { value = getIRI(obj); } return df.getOWLAnnotation(annoProp, value); } if (obj.startsWith("<")) { IRI value = parseIRI(); return df.getOWLAnnotation(annoProp, value); } OWLLiteral con = parseLiteral(null); return df.getOWLAnnotation(annoProp, con); }
protected OWLAnnotation parseAnnotation() { OWLAnnotationProperty annoProp = parseAnnotationProperty(); String obj = peekToken(); if (isIndividualName(obj) || isClassName(obj) || isObjectPropertyName(obj) || isDataPropertyName(obj)) { consumeToken(); OWLAnnotationValue value; if (obj.startsWith("_:")) { value = anonProvider.getOWLAnonymousIndividual(obj); } else { value = getIRI(obj); } return df.getOWLAnnotation(annoProp, value); } if (obj.startsWith("<")) { IRI value = parseIRI(); return df.getOWLAnnotation(annoProp, value); } OWLLiteral con = parseLiteral(null); return df.getOWLAnnotation(annoProp, con); }
private SWRLAtom parseRuleAtom() { String predicate = peekToken(); if (isClassName(predicate)) { return parseClassAtom(); } else if (OPEN.matches(predicate)) { return parseClassAtom(); } else if (isObjectPropertyName(predicate)) { return parseObjectPropertyAtom(); } else if (isDataPropertyName(predicate)) { return parseDataPropertyAtom(); } else if (isDatatypeName(predicate)) { return parseDataRangeAtom(); } else if (DIFFERENT_FROM.matchesEitherForm(predicate)) { return parseDifferentFromAtom(); } else if (SAME_AS.matchesEitherForm(predicate)) { return parseSameAsAtom(); } else if (isSWRLBuiltin(predicate) || predicate.startsWith("<")) { return parseBuiltInAtom(); } else { consumeToken(); Set<String> kw = new TreeSet<>(); kw.addAll(ruleBuiltIns.keySet()); kw.add(DIFFERENT_FROM.toString()); kw.add(SAME_AS.toString()); throw new ExceptionBuilder().withKeyword(kw).withClass().withObject().withData() .build(); } }
private SWRLAtom parseRuleAtom() { String predicate = peekToken(); if (isClassName(predicate)) { return parseClassAtom(); } else if (OPEN.matches(predicate)) { return parseClassAtom(); } else if (isObjectPropertyName(predicate)) { return parseObjectPropertyAtom(); } else if (isDataPropertyName(predicate)) { return parseDataPropertyAtom(); } else if (isDatatypeName(predicate)) { return parseDataRangeAtom(); } else if (DIFFERENT_FROM.matchesEitherForm(predicate)) { return parseDifferentFromAtom(); } else if (SAME_AS.matchesEitherForm(predicate)) { return parseSameAsAtom(); } else if (isSWRLBuiltin(predicate) || predicate.startsWith("<")) { return parseBuiltInAtom(); } else { consumeToken(); Set<String> kw = new TreeSet<>(); kw.addAll(ruleBuiltIns.keySet()); kw.add(DIFFERENT_FROM.toString()); kw.add(SAME_AS.toString()); throw new ExceptionBuilder().withKeyword(kw).withClass().withObject().withData() .build(); } }
private OWLPropertyExpression parsePropertyExpression() { String tok = peekToken(); if (isObjectPropertyName(tok)) { return parseObjectPropertyExpression(false); } else if (INVERSE.matches(tok)) { return parseObjectPropertyExpression(false); } else if (isDataPropertyName(tok)) { return parseDataProperty(); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLPropertyExpression parsePropertyExpression() { String tok = peekToken(); if (isObjectPropertyName(tok)) { return parseObjectPropertyExpression(false); } else if (INVERSE.matches(tok)) { return parseObjectPropertyExpression(false); } else if (isDataPropertyName(tok)) { return parseDataProperty(); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLPropertyExpression parsePropertyExpression() { String tok = peekToken(); if (isObjectPropertyName(tok)) { return parseObjectPropertyExpression(false); } else if (INVERSE.matches(tok)) { return parseObjectPropertyExpression(false); } else if (isDataPropertyName(tok)) { return parseDataProperty(); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLPropertyExpression parsePropertyExpression() { String tok = peekToken(); if (isObjectPropertyName(tok)) { return parseObjectPropertyExpression(false); } else if (INVERSE.matches(tok)) { return parseObjectPropertyExpression(false); } else if (isDataPropertyName(tok)) { return parseDataProperty(); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private SWRLAtom parseObjectPropertyAtom() { String predicate = consumeToken(); if (!isObjectPropertyName(predicate)) { throw new ExceptionBuilder().withObject().build(); } consumeToken(OPEN.keyword()); SWRLIArgument obj1 = parseIObject(); consumeToken(COMMA.keyword()); SWRLIArgument obj2 = parseIObject(); consumeToken(CLOSE.keyword()); return df.getSWRLObjectPropertyAtom(getOWLObjectProperty(predicate), obj1, obj2); }
private SWRLAtom parseObjectPropertyAtom() { String predicate = consumeToken(); if (!isObjectPropertyName(predicate)) { throw new ExceptionBuilder().withObject().build(); } consumeToken(OPEN.keyword()); SWRLIArgument obj1 = parseIObject(); consumeToken(COMMA.keyword()); SWRLIArgument obj2 = parseIObject(); consumeToken(CLOSE.keyword()); return df.getSWRLObjectPropertyAtom(getOWLObjectProperty(predicate), obj1, obj2); }
private SWRLAtom parseObjectPropertyAtom() { String predicate = consumeToken(); if (!isObjectPropertyName(predicate)) { throw new ExceptionBuilder().withObject().build(); } consumeToken(OPEN.keyword()); SWRLIArgument obj1 = parseIObject(); consumeToken(COMMA.keyword()); SWRLIArgument obj2 = parseIObject(); consumeToken(CLOSE.keyword()); return df.getSWRLObjectPropertyAtom(getOWLObjectProperty(predicate), obj1, obj2); }
private SWRLAtom parseObjectPropertyAtom() { String predicate = consumeToken(); if (!isObjectPropertyName(predicate)) { throw new ExceptionBuilder().withObject().build(); } consumeToken(OPEN.keyword()); SWRLIArgument obj1 = parseIObject(); consumeToken(COMMA.keyword()); SWRLIArgument obj2 = parseIObject(); consumeToken(CLOSE.keyword()); return df.getSWRLObjectPropertyAtom(getOWLObjectProperty(predicate), obj1, obj2); }
private OWLAxiom parseFunctionPropertyAxiom() { String kw = consumeToken(); if (!FUNCTIONAL.matches(kw)) { throw new ExceptionBuilder().withKeyword(FUNCTIONAL).build(); } String name = peekToken(); if (isObjectPropertyName(name)) { return df.getOWLFunctionalObjectPropertyAxiom(parseObjectPropertyExpression(false)); } else if (isDataPropertyName(name)) { return df.getOWLFunctionalDataPropertyAxiom(parseDataProperty()); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLAxiom parseFunctionPropertyAxiom() { String kw = consumeToken(); if (!FUNCTIONAL.matches(kw)) { throw new ExceptionBuilder().withKeyword(FUNCTIONAL).build(); } String name = peekToken(); if (isObjectPropertyName(name)) { return df.getOWLFunctionalObjectPropertyAxiom(parseObjectPropertyExpression(false)); } else if (isDataPropertyName(name)) { return df.getOWLFunctionalDataPropertyAxiom(parseDataProperty()); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLAxiom parseFunctionPropertyAxiom() { String kw = consumeToken(); if (!FUNCTIONAL.matches(kw)) { throw new ExceptionBuilder().withKeyword(FUNCTIONAL).build(); } String name = peekToken(); if (isObjectPropertyName(name)) { return df.getOWLFunctionalObjectPropertyAxiom(parseObjectPropertyExpression(false)); } else if (isDataPropertyName(name)) { return df.getOWLFunctionalDataPropertyAxiom(parseDataProperty()); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
private OWLAxiom parseFunctionPropertyAxiom() { String kw = consumeToken(); if (!FUNCTIONAL.matches(kw)) { throw new ExceptionBuilder().withKeyword(FUNCTIONAL).build(); } String name = peekToken(); if (isObjectPropertyName(name)) { return df.getOWLFunctionalObjectPropertyAxiom(parseObjectPropertyExpression(false)); } else if (isDataPropertyName(name)) { return df.getOWLFunctionalDataPropertyAxiom(parseDataProperty()); } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
protected OWLAxiom parseFact(OWLIndividual ind) { boolean negative = false; if (NOT.matches(peekToken())) { consumeToken(); negative = true; } String prop = peekToken(); if (isDataPropertyName(prop)) { OWLDataProperty p = parseDataProperty(); OWLLiteral con = parseLiteral(null); if (!negative) { return df.getOWLDataPropertyAssertionAxiom(p, ind, con); } else { return df.getOWLNegativeDataPropertyAssertionAxiom(p, ind, con); } } else if (isObjectPropertyName(prop) || INVERSE.matches(prop)) { OWLObjectPropertyExpression p = parseObjectPropertyExpression(false); if (!negative) { return df.getOWLObjectPropertyAssertionAxiom(p, ind, parseIndividual()); } else { return df.getOWLNegativeObjectPropertyAssertionAxiom(p, ind, parseIndividual()); } } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }
protected OWLAxiom parseFact(OWLIndividual ind) { boolean negative = false; if (NOT.matches(peekToken())) { consumeToken(); negative = true; } String prop = peekToken(); if (isDataPropertyName(prop)) { OWLDataProperty p = parseDataProperty(); OWLLiteral con = parseLiteral(null); if (!negative) { return df.getOWLDataPropertyAssertionAxiom(p, ind, con); } else { return df.getOWLNegativeDataPropertyAssertionAxiom(p, ind, con); } } else if (isObjectPropertyName(prop) || INVERSE.matches(prop)) { OWLObjectPropertyExpression p = parseObjectPropertyExpression(false); if (!negative) { return df.getOWLObjectPropertyAssertionAxiom(p, ind, parseIndividual()); } else { return df.getOWLNegativeObjectPropertyAssertionAxiom(p, ind, parseIndividual()); } } else { consumeToken(); throw new ExceptionBuilder().withObject().withData().build(); } }