Skip to content

Commit

Permalink
fixed 'x is not a type of class'; improved messaging in JenaTranslato…
Browse files Browse the repository at this point in the history
…rPlugin
  • Loading branch information
Andrew Crapo committed Oct 21, 2020
1 parent b7b65b3 commit a8e7f0f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ else if (ftype.equals(BuiltinType.Assign)) {
Builtin bltin = BuiltinRegistry.theRegistry.getImplementation(builtinName);
if (bltin == null) {
logger.error("Something went wrong finding/loading Builtin '" + builtinName + "'");
addError("Unable to resolve built-in '" + builtinName + "'");
addError("Unable to resolve built-in '" + builtinName + "' in rule '" + getRuleInTranslation().getRuleName() + "'");
}
else {
String uri = bltin.getURI();
Expand Down Expand Up @@ -1466,11 +1466,14 @@ else if (ITranslator.isKnownNode(node)) {
return "?" + getNewVariableForRule();
}
else if (node == null) {
throw new TranslationException("Encountered null node in nodeToString; this indicates incorrect intermediate form and should not happen");
// throw new TranslationException("Encountered null node in nodeToString; this indicates incorrect intermediate form and should not happen");
addError(new ModelError("Encountered null node in nodeToString; this indicates incorrect intermediate form and should not happen", ErrorType.ERROR));
}
else {
throw new TranslationException("Nnode '" + node.toString() + "' cannot be translated to Jena format.");
// throw new TranslationException("Nnode '" + node.toString() + "' cannot be translated to Jena format.");
addError(new ModelError("Nnode '" + node.toString() + "' cannot be translated to Jena format.", ErrorType.ERROR));
}
return "<null>";
}

private Literal constantToLiteral(ConstantNode node) throws TranslationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7664,6 +7664,17 @@ public Object processExpression(PropOfSubject expr)
boolean specialCntIdxProcessing = false;
boolean lIsConstantExpression = false;

boolean predicateIsNegatedType = false;
if (predicate instanceof UnaryExpression &&
((UnaryExpression)predicate).getOp().contentEquals("not") &&
((UnaryExpression)predicate).getExpr() instanceof Constant &&
((Constant)((UnaryExpression)predicate).getExpr()).getConstant().equals("a type")) {
// negated
predicateIsNegatedType = true;
predicate = ((UnaryExpression)predicate).getExpr();
}


if (predicate instanceof Constant) {
// this is a pseudo PropOfSubject; the predicate is a constant
lIsConstantExpression = true;
Expand Down Expand Up @@ -7733,7 +7744,11 @@ public Object processExpression(PropOfSubject expr)
trPred = new NamedNode(RDFS.subClassOf.getURI()); // new RDFTypeNode();
((NamedNode)trPred).setContext(predicate);
((NamedNode)trPred).setNodeType(NodeType.ObjectProperty);
return new TripleElement((Node)null, (Node)trPred, (Node)trSubj);
TripleElement tr = new TripleElement((Node)null, (Node)trPred, (Node)trSubj);
if (predicateIsNegatedType) {
tr.setType(TripleModifierType.Not);
}
return tr;
} else if (cnstval.equals("value") && getTarget() instanceof Query) {
// this is to be a delayed evaluation: don't use the expression as the query but evaluate
// the expression at runtime and use the value as the query
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
provider-name="GE Global Research">

<description url="http://www.example.com/description">
The SADL Prlog Plug-in is a Prolog-based reasoner for the Semantic Application Design Language (SADL), which is a controlled
The SADL Prolog Plug-in is a Prolog-based reasoner for the Semantic
Application Design Language (SADL), which is a controlled
English grammar and Eclipse IDE for building, testing, and deploying
semantic models.
</description>
Expand Down

0 comments on commit a8e7f0f

Please sign in to comment.