Search Mailing List Archives
[protege-discussion] PAL ValidationErrorImpl errors when using API but not GUI
Samson Tu
swt at stanford.edu
Wed Aug 6 09:42:21 PDT 2008
Open your pal.jar file with Winzip and verify that the manifest.mf file
has entries like:
Name: edu/stanford/smi/protegex/pal/predicates/LessThanP.class
PAL-Predicate: True
Make sure that your are using the same jar files and jvm
programmatically as Protege GUI.
I am not aware of any change made to PAL in recent years.
Samson
Bertram Stuart wrote:
> Hi,
>
> I have an application that uses a Protege ontology (pprj format) and a
> number of PAL rules for validation. Those PAL rules are called through
> the API, looping over each constraint and calling the following:
>
>
> EvaluationPolicy evalPolicy = new EvaluationPolicy();
> evalPolicy.setFindAllCounterExamples(true);
> ConstraintEvaluationEngine evalEngine = new
> ConstraintEvaluationEngine(evalPolicy, kb);
> ConstraintEngineResponse response =
> evalEngine.checkSingleStatement(palConstraint);
> Collection<ConstraintViolation> constraintResult = null;
>
> if (response.areThereValidationErrors())
> {
> for (Object obj : response.getValidationErrors(palConstraint))
> {
> log.warn(obj.toString());
> }
> }
> else if (response.areThereConstraintViolations())
> {
> constraintResult = response.getConstraintViolations(palConstraint);
> log.info("Number of violations of " + palConstraint.getBrowserText() +
> " = " + constraintResult.size());
> }
> else
> {
> log.info("No constraint violations for " + palConstraint.getBrowserText());
> }
>
>
> palConstraint is an Instance that is the constraint and kb is the
> KnowledgeBase that the palConstraint was taken from and should be
> checked against. log is just a Log4J logger.
>
> This has worked perfectly fine until recently, when it has started
> failing to parse the PAL rules and instead returning ValidationErrorImpl
> errors. The rules themselves are perfectly fine, as I can run them from
> within Protege and they pass/fail as appropriate. The problem is only
> from API calls, which get messages like the following:
>
> Predicate named < is referenced but not defined.
> Predicate named > is referenced but not defined.
> Function named number-of-own-slot-values is referenced but not defined.
> Function named coerce-to-string is referenced but not defined.
>
> Given that the predicates and functions are core functionality, I am at
> a loss as to how they can not be defined. I have the protege.jar (3.3.1
> and 3.2.1 have been tested), lax.jar and looks-2.1.3.jar files from the
> Protege folder, plus antlr.jar and pal.jar from the plugins all included
> in my project.
>
> Any suggestions on what might be causing core predicates and functions
> to fail as "not defined", especially when it works from the Protege app
> and worked as API calls until recently?
More information about the protege-discussion
mailing list