public boolean getBoolean() { return getLiteral().getBoolean(); }
public boolean getBoolean() { return getLiteral().getBoolean(); }
/** * Return the boolean value of a literal node. Depending on the backend implementing this method, * the value can be retrieved directly or must be parsed from the string representation. * TODO: Define:<ul> * <li> Do we also support '0' '1', 'yes', 'no'; whats about case insensitive * such as TRUE, False * <li> should we throw an RuntimeException of not an boolean value or return * false as {@link Boolean#parseBoolean(String)} * </ul> * * @param rdfNode the literal node for which to return the boolean value * @return long value of the literal node * @throws IllegalArgumentException in case the node passed as argument is not a literal */ @Override public Boolean booleanValue(RDFNode rdfNode) { if(isLiteral(rdfNode)) { return ((Literal)rdfNode).getBoolean(); } else { throw new IllegalArgumentException("the node "+rdfNode+" is not a literal value"); } }
@Override public boolean getBoolean() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return holder.getBaseItem().getBoolean(); }
@Override public Map<OWLIndividual, SortedSet<Boolean>> getBooleanDatatypeMembersImpl(OWLDataProperty datatypeProperty) { Map<OWLIndividual, SortedSet<Boolean>> subject2objects = new HashMap<>(); String query = "SELECT ?s ?o WHERE {" + String.format("?s <%s> ?o.", datatypeProperty.toStringID()) + " FILTER(" + datatypeSparqlFilter(OWLAPIUtils.fixedDatatypes) + ")}"; ResultSet rs = executeSelectQuery(query); while(rs.hasNext()){ QuerySolution qs = rs.next(); OWLIndividual sub = df.getOWLNamedIndividual(IRI.create(qs.getResource("s").getURI())); Boolean obj = qs.getLiteral("o").getBoolean(); subject2objects.computeIfAbsent(sub, k -> new TreeSet<>()).add(obj); } return subject2objects; }
public void testBooleans() { Assert.assertTrue(model.createTypedLiteral(true).getBoolean()); Assert.assertFalse(model.createTypedLiteral(false).getBoolean()); }
public void testBooleans() { Assert.assertTrue(model.createTypedLiteral(true).getBoolean()); Assert.assertFalse(model.createTypedLiteral(false).getBoolean()); }
public void testGetTrueBoolean() { Assert.assertEquals(true, model.createLiteralStatement(r, RDF.value, true).getLiteral() .getBoolean()); }
public void testGetTrueBoolean() { Assert.assertEquals(true, model.createLiteralStatement(r, RDF.value, true).getLiteral() .getBoolean()); }
RDFNode object = stmt.getObject(); if (object != null && object.isLiteral()){ existingValue = ((Literal)object).getBoolean();
/** * convenience method */ protected Boolean getPropertyBooleanValue(OntResource res, Property dataprop) { if (dataprop != null) { try { ClosableIterator stateIt = getOntModel().listStatements(res,dataprop,(Literal)null); try { if (stateIt.hasNext()) return ((Literal)((Statement)stateIt.next()).getObject()).getBoolean(); else return null; } finally { stateIt.close(); } } catch (Exception e) { return null; } } else { return null; } }
Boolean isEstimate = qualityMD.listObjectsOfProperty(res, DAQ.isEstimate).next().asLiteral().getBoolean();
Boolean isEstimate = qualityMD.listObjectsOfProperty(res, DAQ.isEstimate).next().asLiteral().getBoolean();
Boolean isEstimate = qualityMD.listObjectsOfProperty(res, DAQ.isEstimate).next().asLiteral().getBoolean();
@Override public ComponentParameter read(Resource resource) { checkNotNull(resource); ComponentParameterImpl.ComponentParameterImplBuilder argumentBuilder = ComponentParameterImpl.builder(); argumentBuilder.element(resource); // get path for (Statement smt : resource.listProperties(SHACL.path).toList()) { argumentBuilder = argumentBuilder.predicate(ResourceFactory.createProperty(smt.getObject().asResource().getURI())); } checkNotNull(argumentBuilder); //default value for (Statement smt : resource.listProperties(SHACL.defaultValue).toList()) { argumentBuilder.defaultValue(smt.getObject()); } // get optional for (Statement smt : resource.listProperties(SHACL.optional).toList()) { argumentBuilder.isOptional(smt.getObject().asLiteral().getBoolean()); } return argumentBuilder.build(); } }
@Override public ComponentParameter read(Resource resource) { checkNotNull(resource); ComponentParameterImpl.ComponentParameterImplBuilder argumentBuilder = ComponentParameterImpl.builder(); argumentBuilder.element(resource); // get path for (Statement smt : resource.listProperties(SHACL.path).toList()) { argumentBuilder = argumentBuilder.predicate(ResourceFactory.createProperty(smt.getObject().asResource().getURI())); } checkNotNull(argumentBuilder); //default value for (Statement smt : resource.listProperties(SHACL.defaultValue).toList()) { argumentBuilder.defaultValue(smt.getObject()); } // get optional for (Statement smt : resource.listProperties(SHACL.optional).toList()) { argumentBuilder.isOptional(smt.getObject().asLiteral().getBoolean()); } return argumentBuilder.build(); } }
RDFNode valueNode = actionInd.getPropertyValue(WorkflowOntology.applyChangesDirectlyToSource); if ((valueNode != null) && (valueNode.isLiteral())) { applyChangesDirectlyToSource = ((Literal)valueNode.as(Literal.class)).getBoolean();
public ActionResult handleAction(Individual actionInd) { if (instanceOf(actionInd,WorkflowOntology.SplitPropertyValuesAction)) { // We use an OntModel here because this API supports submodels OntModel sourceModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); for (RDFNode node : (List<RDFNode>) actionInd.listPropertyValues(WorkflowOntology.sourceModel).toList()) { sourceModel.addSubModel(getModel(node)); } Model destinationModel = getModel(actionInd.getPropertyValue(WorkflowOntology.destinationModel)); String propertyURI = getValue(actionInd.getPropertyValue(WorkflowOntology.originalProperty)).getLexicalForm(); String newPropertyURI = getValue(actionInd.getPropertyValue(WorkflowOntology.newProperty)).getLexicalForm(); String splitRegex = getValue(actionInd.getPropertyValue(WorkflowOntology.splitRegex)).getLexicalForm(); boolean trim = true; try { trim = getValue(actionInd.getPropertyValue(WorkflowOntology.trim)).getBoolean(); } catch (Exception e) {} destinationModel.enterCriticalSection(Lock.WRITE); try { destinationModel.add(utils.splitPropertyValues(sourceModel, propertyURI, splitRegex, newPropertyURI, trim)); } finally { destinationModel.leaveCriticalSection(); } return new ActionResultImpl(); } else { return null; } } }
RDFNode valueNode = actionInd.getPropertyValue(WorkflowOntology.applyChangesDirectlyToSource); if ((valueNode != null) && (valueNode.isLiteral())) { applyChangesDirectlyToSource = ((Literal)valueNode.as(Literal.class)).getBoolean();
boolean b = ((Literal) valueStmt.getObject()).getBoolean(); return new ParamSpec(name, b, boolean.class);