use of org.apache.stanbol.rules.manager.atoms.IObjectAtom in project stanbol by apache.
the class RuleParserImpl method individualPropertyAtom.
public final IndividualPropertyAtom individualPropertyAtom() throws ParseException {
IObjectAtom uri1;
IObjectAtom uri2;
IObjectAtom uri3;
jj_consume_token(HAS);
jj_consume_token(LPAR);
uri1 = iObject();
jj_consume_token(COMMA);
uri2 = iObject();
jj_consume_token(COMMA);
uri3 = iObject();
jj_consume_token(RPAR);
{
if (true)
return new IndividualPropertyAtom(uri1, uri2, uri3);
}
throw new Error("Missing return statement in function");
}
use of org.apache.stanbol.rules.manager.atoms.IObjectAtom in project stanbol by apache.
the class RuleParserImpl method classAtom.
public final ClassAtom classAtom() throws ParseException {
IObjectAtom uri1;
IObjectAtom uri2;
jj_consume_token(IS);
jj_consume_token(LPAR);
uri1 = iObject();
jj_consume_token(COMMA);
uri2 = iObject();
jj_consume_token(RPAR);
{
if (true)
return new ClassAtom(uri1, uri2);
}
throw new Error("Missing return statement in function");
}
use of org.apache.stanbol.rules.manager.atoms.IObjectAtom in project stanbol by apache.
the class RuleParserImpl method literal.
public final ExpressionAtom literal() throws ParseException {
ExpressionAtom literal;
IObjectAtom typedLiteral;
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case STRING:
literal = getString();
typedLiteral = typedLiteral();
break;
case NUM:
literal = getInt();
typedLiteral = typedLiteral();
break;
default:
jj_la1[13] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (typedLiteral != null) {
{
if (true)
return new TypedLiteralAtom(literal, typedLiteral);
}
} else {
{
if (true)
return literal;
}
}
throw new Error("Missing return statement in function");
}
use of org.apache.stanbol.rules.manager.atoms.IObjectAtom in project stanbol by apache.
the class DatavaluedPropertyAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException {
org.apache.stanbol.rules.manager.atoms.DatavaluedPropertyAtom tmp = (org.apache.stanbol.rules.manager.atoms.DatavaluedPropertyAtom) ruleAtom;
IObjectAtom argument1 = tmp.getArgument1();
IObjectAtom datatypeProperty = tmp.getDatatypeProperty();
RuleAtom argument2 = tmp.getArgument2();
SWRLAtom arg1Atom = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
SWRLAtom predicateAtom = (SWRLAtom) adapter.adaptTo(datatypeProperty, SWRLRule.class);
SWRLAtom arg2Atom = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLDataProperty owlDataProperty;
SWRLIArgument swrliArgument;
SWRLDArgument swrldArgument;
if (predicateAtom instanceof ArgumentSWRLAtom) {
owlDataProperty = factory.getOWLDataProperty(IRI.create(((ArgumentSWRLAtom) predicateAtom).getId()));
} else {
throw new RuleAtomCallExeption(getClass());
}
if (arg1Atom instanceof ArgumentSWRLAtom) {
swrliArgument = (SWRLIArgument) ((ArgumentSWRLAtom) arg1Atom).getSwrlArgument();
} else {
throw new RuleAtomCallExeption(getClass());
}
if (arg2Atom instanceof ArgumentSWRLAtom) {
swrldArgument = (SWRLDArgument) ((ArgumentSWRLAtom) arg2Atom).getSwrlArgument();
} else {
throw new RuleAtomCallExeption(getClass());
}
return (T) factory.getSWRLDataPropertyAtom(owlDataProperty, swrliArgument, swrldArgument);
}
use of org.apache.stanbol.rules.manager.atoms.IObjectAtom in project stanbol by apache.
the class IndividualPropertyAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException {
org.apache.stanbol.rules.manager.atoms.IndividualPropertyAtom tmp = (org.apache.stanbol.rules.manager.atoms.IndividualPropertyAtom) ruleAtom;
IObjectAtom argument1 = tmp.getArgument1();
IObjectAtom argument2 = tmp.getArgument2();
IObjectAtom objectProperty = tmp.getObjectProperty();
SWRLAtom predicateAtom = (SWRLAtom) adapter.adaptTo(objectProperty, SWRLRule.class);
SWRLAtom subjectAtom = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
SWRLAtom objectAtom = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLObjectProperty owlObjectProperty;
SWRLIArgument swrliArgument1;
SWRLIArgument swrliArgument2;
if (predicateAtom instanceof ArgumentSWRLAtom) {
owlObjectProperty = factory.getOWLObjectProperty(IRI.create(((ArgumentSWRLAtom) predicateAtom).getId()));
} else {
throw new RuleAtomCallExeption(getClass());
}
if (subjectAtom instanceof ArgumentSWRLAtom) {
swrliArgument1 = (SWRLIArgument) ((ArgumentSWRLAtom) subjectAtom).getSwrlArgument();
} else {
throw new RuleAtomCallExeption(getClass());
}
if (objectAtom instanceof ArgumentSWRLAtom) {
swrliArgument2 = (SWRLIArgument) ((ArgumentSWRLAtom) objectAtom).getSwrlArgument();
} else {
throw new RuleAtomCallExeption(getClass());
}
return (T) factory.getSWRLObjectPropertyAtom(owlObjectProperty, swrliArgument1, swrliArgument2);
}
Aggregations