/** * <p>Answer true if this resource has the given label</p> * @param label The label to test for * @return True if this resource has <code>label</code> as a label. */ @Override public boolean hasLabel( Literal label ) { boolean found = false; ExtendedIterator<RDFNode> i = listLabels( label.getLanguage() ); while (!found && i.hasNext()) { found = label.equals( i.next() ); } i.close(); return found; }
/** * <p>Answer true if this resource has the given comment.</p> * @param comment The comment to test for * @return True if this resource has <code>comment</code> as a comment. */ @Override public boolean hasComment( Literal comment ) { boolean found = false; ExtendedIterator<RDFNode> i = listComments( comment.getLanguage() ); while (!found && i.hasNext()) { found = comment.equals( i.next() ); } i.close(); return found; }
/** * <p>Answer true if this resource has the given label</p> * @param label The label to test for * @return True if this resource has <code>label</code> as a label. */ @Override public boolean hasLabel( Literal label ) { boolean found = false; ExtendedIterator<RDFNode> i = listLabels( label.getLanguage() ); while (!found && i.hasNext()) { found = label.equals( i.next() ); } i.close(); return found; }
/** * <p>Answer true if this resource has the given comment.</p> * @param comment The comment to test for * @return True if this resource has <code>comment</code> as a comment. */ @Override public boolean hasComment( Literal comment ) { boolean found = false; ExtendedIterator<RDFNode> i = listComments( comment.getLanguage() ); while (!found && i.hasNext()) { found = comment.equals( i.next() ); } i.close(); return found; }
/** * Test that equality function takes lexical distinction into account. */ public void testLexicalDistinction() { Literal l1 = m.createTypedLiteral("3.0", XSDDatatype.XSDdecimal); Literal l2 = m.createTypedLiteral("3.00", XSDDatatype.XSDdecimal); Literal l3 = m.createTypedLiteral("3.0", XSDDatatype.XSDdecimal); assertSameValueAs("lexical form does not affect value", l1, l2); assertSameValueAs("lexical form does not affect value", l3, l2); assertTrue("lexical form affects equality", ! l1.equals(l2)); assertTrue("lexical form affects equality", l1.equals(l3)); // This version will become illegal in the future and will be removed then l1 = m.createTypedLiteral("3", XSDDatatype.XSDint); l2 = m.createTypedLiteral(" 3 ", XSDDatatype.XSDint); l3 = m.createTypedLiteral("3", XSDDatatype.XSDint); assertSameValueAs("lexical form does not affect value", l1, l2); assertSameValueAs("lexical form does not affect value", l3, l2); assertTrue("lexical form affects equality", ! l1.equals(l2)); assertTrue("lexical form affects equality", l1.equals(l3)); }
/** * Test that equality function takes lexical distinction into account. */ public void testLexicalDistinction() { Literal l1 = m.createTypedLiteral("3.0", XSDDatatype.XSDdecimal); Literal l2 = m.createTypedLiteral("3.00", XSDDatatype.XSDdecimal); Literal l3 = m.createTypedLiteral("3.0", XSDDatatype.XSDdecimal); assertSameValueAs("lexical form does not affect value", l1, l2); assertSameValueAs("lexical form does not affect value", l3, l2); assertTrue("lexical form affects equality", ! l1.equals(l2)); assertTrue("lexical form affects equality", l1.equals(l3)); // This version will become illegal in the future and will be removed then l1 = m.createTypedLiteral("3", XSDDatatype.XSDint); l2 = m.createTypedLiteral(" 3 ", XSDDatatype.XSDint); l3 = m.createTypedLiteral("3", XSDDatatype.XSDint); assertSameValueAs("lexical form does not affect value", l1, l2); assertSameValueAs("lexical form does not affect value", l3, l2); assertTrue("lexical form affects equality", ! l1.equals(l2)); assertTrue("lexical form affects equality", l1.equals(l3)); }
@Override public void executeConstraint(Constraint constraint, ValidationEngine engine, List<RDFNode> focusNodes) { // TODO: optimize, currently produces a new NodeExpression each time NodeExpression expr = NodeExpressionFactory.get().create(constraint.getParameterValue()); for(RDFNode focusNode : focusNodes) { engine.checkCanceled(); for(RDFNode valueNode : engine.getValueNodes(constraint, focusNode)) { List<RDFNode> results = expr.eval(valueNode, engine); if(results.size() != 1 || !JenaDatatypes.TRUE.equals(results.get(0))) { Resource result = engine.createResult(SH.ValidationResult, constraint, focusNode); result.addProperty(SH.value, valueNode); result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); if(constraint.getParameterValue() instanceof Resource && ((Resource)constraint.getParameterValue()).hasProperty(SH.message)) { for(Statement s : ((Resource)constraint.getParameterValue()).listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { result.addProperty(SH.resultMessage, "Expression does not evaluate to true"); } } } } } }
@Override public void executeConstraint(Constraint constraint, ValidationEngine engine, List<RDFNode> focusNodes) { // TODO: optimize, currently produces a new NodeExpression each time NodeExpression expr = NodeExpressionFactory.get().create(constraint.getParameterValue()); for(RDFNode focusNode : focusNodes) { engine.checkCanceled(); for(RDFNode valueNode : engine.getValueNodes(constraint, focusNode)) { List<RDFNode> results = expr.eval(valueNode, engine).toList(); if(results.size() != 1 || !JenaDatatypes.TRUE.equals(results.get(0))) { Resource result = engine.createResult(SH.ValidationResult, constraint, focusNode); result.addProperty(SH.value, valueNode); result.addProperty(SH.sourceConstraint, constraint.getParameterValue()); if(constraint.getParameterValue() instanceof Resource && ((Resource)constraint.getParameterValue()).hasProperty(SH.message)) { for(Statement s : ((Resource)constraint.getParameterValue()).listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else if(constraint.getShapeResource().hasProperty(SH.message)) { for(Statement s : constraint.getShapeResource().listProperties(SH.message).toList()) { result.addProperty(SH.resultMessage, s.getObject()); } } else { result.addProperty(SH.resultMessage, "Expression does not evaluate to true"); } } } } } }
seq4.add(tvLiteral); n++; if (!(seq4.getLiteral(13).equals(tvLiteral)))
Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint);
Resource resultType = SH.ValidationResult; RDFNode selectMessage = sol.get(SH.message.getLocalName()); if(JenaDatatypes.TRUE.equals(sol.get(SH.failureVar.getName()))) { resultType = DASH.FailureResult; String message = getLabel(constraint);
seq4.add(tvLiteral); n++; if (!(seq4.getLiteral(13).equals(tvLiteral)))
if (!(seq6.getLiteral(1).equals(tvLiteral)))
if (!(seq6.getLiteral(1).equals(tvLiteral)))
seq7.set(5, tvLiteral); n++; if (!(seq7.getLiteral(5).equals(tvLiteral)))
seq7.set(5, tvLiteral); n++; if (!(seq7.getLiteral(5).equals(tvLiteral)))