@Override public void resolvePropertyIds(JSONArray filterJson, String workspaceId) throws JSONException { for (int i = 0; i < filterJson.length(); i++) { JSONObject filter = filterJson.getJSONObject(i); if (filter.has("propertyId") && !filter.has("propertyName")) { String propertyVertexId = filter.getString("propertyId"); OntologyProperty property = getPropertyByIRI(propertyVertexId, workspaceId); if (property == null) { throw new RuntimeException("Could not find property with id: " + propertyVertexId); } filter.put("propertyName", property.getTitle()); filter.put("propertyDataType", property.getDataType()); } } }
public Object convertString(String valueStr) throws ParseException { PropertyType dataType = getDataType(); Object value = valueStr; switch (dataType) { case DATE: value = parseDateTime(valueStr); break; case GEO_LOCATION: value = parseGeoLocation(valueStr); break; case CURRENCY: value = new BigDecimal(valueStr); break; case DOUBLE: value = Double.parseDouble(valueStr); break; case INTEGER: value = Integer.parseInt(valueStr); break; case BOOLEAN: value = Boolean.parseBoolean(valueStr); break; } return value; }
PropertyType dataType = getDataType(); switch (dataType) { case DATE:
Class propertyType = PropertyType.getTypeClass(property.getDataType()); if (propertyType.equals(BigDecimal.class)) { propertyType = Double.class;
public VisalloProperty getVisalloProperty() { switch (getDataType()) { case IMAGE: case BINARY: return new StreamingVisalloProperty(getIri()); case BOOLEAN: return new BooleanVisalloProperty(getIri()); case DATE: return new DateVisalloProperty(getIri()); case CURRENCY: case DOUBLE: return new DoubleVisalloProperty(getIri()); case GEO_LOCATION: return new GeoPointVisalloProperty(getIri()); case GEO_SHAPE: return new GeoShapeVisalloProperty(getIri()); case INTEGER: return new IntegerVisalloProperty(getIri()); case STRING: case DIRECTORY_ENTITY: return new StringVisalloProperty(getIri()); default: throw new VisalloException("Could not get " + VisalloProperty.class.getName() + " for data type " + getDataType()); } }
private void validateTestOwlProperties() { OntologyProperty nameProperty = getOntologyRepository().getPropertyByIRI(TEST_IRI + "#name", PUBLIC); assertEquals("Name", nameProperty.getDisplayName()); assertEquals(PropertyType.STRING, nameProperty.getDataType()); assertEquals("_.compact([\n" + " dependentProp('http://visallo.org/test#firstName'),\n" + assertEquals(PropertyType.DATE, firstMetProperty.getDataType());
private void validateChangedOwlProperties() throws IOException { OntologyProperty nameProperty = getOntologyRepository().getPropertyByIRI(TEST_IRI + "#name", PUBLIC); assertEquals("http://visallo.org/test#name", nameProperty.getDisplayName()); assertEquals(PropertyType.STRING, nameProperty.getDataType()); assertEquals("_.compact([\n" + " dependentProp('http://visallo.org/test#firstName'),\n" + assertEquals(PropertyType.DATE, firstMetProperty.getDataType());
@Handle public ClientApiElementSearchResponse handle( @Required(name = "lat") double latitude, @Required(name = "lon") double longitude, @Required(name = "radius") double radius, @ActiveWorkspaceId String workspaceId, Authorizations authorizations ) throws Exception { ClientApiElementSearchResponse results = new ClientApiElementSearchResponse(); for (OntologyProperty property : this.ontologyRepository.getProperties(workspaceId)) { if (property.getDataType() != PropertyType.GEO_LOCATION) { continue; } Iterable<Vertex> vertices = graph.query(authorizations). has(property.getTitle(), GeoCompare.WITHIN, new GeoCircle(latitude, longitude, radius)). vertices(); for (Vertex vertex : vertices) { results.getElements().add(ClientApiConverter.toClientApiVertex(vertex, workspaceId, authorizations)); } } return results; } }
result.setAddable(getAddable()); result.setSortable(getSortable()); result.setDataType(getDataType()); result.setDisplayType(getDisplayType()); result.setPropertyGroup(getPropertyGroup());