@SuppressWarnings("unchecked") private Operation<?> transformPathEqNeConstant(Operation<?> operation) { Path<?> path = (Path<?>) operation.getArg(0); Constant<?> constant = (Constant<?>) operation.getArg(1); MappedPath mappedPath = getMappedPath(path); // id property if (path.getMetadata().getPathType() == PathType.PROPERTY && constant.getType().equals(String.class) && mappedPath.getPredicatePath().isEmpty()) { operation = PredicateOperation.create((Operator) operation.getOperator(), path, new ConstantImpl<ID>(session.getId(new LID(constant.toString())))); // localized property } else if (mappedPath.getMappedProperty().isLocalized()) { Locale locale; if (path.getMetadata().getPathType() == PathType.PROPERTY) { locale = session.getCurrentLocale(); } else { locale = (Locale) path.getMetadata().getElement(); } operation = PredicateOperation.create((Operator) operation.getOperator(), path, new ConstantImpl<LIT>(new LIT(constant.toString(), locale))); } return operation; }
if (statements.containsKey(predicate)) { for (STMT statement : statements.get(predicate)) { if (property.isLocalized() && String.class.equals(property.getType())) { LIT lit = (LIT) statement.getObject(); if (Objects.equal(getCurrentLocale(), lit.getLang())) { } else if (property.isLocalized()) { if (property.isMap()) { for (Map.Entry<Locale, String> entry : ((Map<Locale, String>) object).entrySet()) {
else if (mappedProperty.isLocalized()) { if (mappedProperty.isMap()) { convertedValue = convertLocalizedMap(propertyPath, values);
MappedPath mappedPath = getMappedPath(md.getParent()); MappedProperty<?> mappedProperty = mappedPath.getMappedProperty(); if (!mappedProperty.isLocalized()) { Object element = path.getMetadata().getElement(); Expression<?> expr = transform(element instanceof Expression ?
if (mappedProperty.isAnyResource()) { range = RDFS.Resource; } else if (mappedProperty.isLocalized()) { range = RDF.text; } else {
@Test public void Localized() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addClass(TEST.NS, Labeled.class) .addLocalized("label", RDFS.label) .addProperty("comment", RDFS.comment); Configuration configuration = builder.build(); // labeled MappedClass labeled = configuration.getMappedClass(Labeled.class); MappedPath labeled_label = labeled.getMappedPath("label"); assertTrue(labeled_label.getMappedProperty().isLocalized()); assertEquals(RDFS.label, labeled_label.getPredicatePath().get(0).getUID()); MappedPath labeled_comment = labeled.getMappedPath("comment"); assertFalse(labeled_comment.getMappedProperty().isLocalized()); assertEquals(RDFS.comment, labeled_comment.getPredicatePath().get(0).getUID()); }