use of org.smartdata.rule.objects.SmartObject in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitObjTypeWith.
@Override
public TreeNode visitObjTypeWith(SmartRuleParser.ObjTypeWithContext ctx) {
String objName = ctx.OBJECTTYPE().getText();
SmartObject obj = SmartObject.getInstance(objName);
objects.put(objName, obj);
objects.put("Default", obj);
objFilter = visit(ctx.objfilter());
return null;
}
use of org.smartdata.rule.objects.SmartObject in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitObjTypeOnly.
@Override
public TreeNode visitObjTypeOnly(SmartRuleParser.ObjTypeOnlyContext ctx) {
String objName = ctx.OBJECTTYPE().getText();
SmartObject obj = SmartObject.getInstance(objName);
objects.put(objName, obj);
objects.put("Default", obj);
return null;
}
use of org.smartdata.rule.objects.SmartObject in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitIdAttPara.
@Override
public TreeNode visitIdAttPara(SmartRuleParser.IdAttParaContext ctx) {
SmartObject obj = createIfNotExist("Default");
Property p = obj.getProperty(ctx.ID().getText());
if (p == null) {
throw new RuleParserException("Object " + obj.toString() + " does not have a attribute named '" + ctx.ID().getText() + "'");
}
if (p.getParamsTypes() == null) {
throw new RuleParserException(obj.toString() + "." + ctx.ID().getText() + " does not need parameter(s)");
}
int numParameters = ctx.getChildCount() / 2 - 1;
if (p.getParamsTypes().size() != numParameters) {
throw new RuleParserException(obj.toString() + "." + ctx.ID().getText() + " needs " + p.getParamsTypes().size() + " instead of " + numParameters);
}
return parseIdParams(ctx, p, 2);
}
use of org.smartdata.rule.objects.SmartObject in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method visitIdObjAtt.
@Override
public TreeNode visitIdObjAtt(SmartRuleParser.IdObjAttContext ctx) {
SmartObject obj = createIfNotExist(ctx.OBJECTTYPE().toString());
Property p = obj.getProperty(ctx.ID().getText());
if (p == null) {
throw new RuleParserException("Object " + obj.toString() + " does not have a attribute named '" + "'" + ctx.ID().getText());
}
if (p.getParamsTypes() != null) {
throw new RuleParserException("Should have no parameter(s) for " + ctx.getText());
}
PropertyRealParas realParas = new PropertyRealParas(p, null);
realParases.add(realParas);
return new ValueNode(new VisitResult(p.getValueType(), null, realParas));
}
use of org.smartdata.rule.objects.SmartObject in project SSM by Intel-bigdata.
the class SmartRuleVisitTranslator method createIfNotExist.
private SmartObject createIfNotExist(String objName) {
SmartObject obj = objects.get(objName);
if (obj == null) {
obj = SmartObject.getInstance(objName);
objects.put(objName, obj);
}
return obj;
}
Aggregations