Package org.apache.stanbol.commons.jsonld

Examples of org.apache.stanbol.commons.jsonld.JsonLdPropertyValue


                    if (jldProperty == null) {
                        jldProperty = new JsonLdProperty(property);
                    }
                   
                    String strValue = currentTriple.getObject().toString();
                    JsonLdPropertyValue jldValue = new JsonLdPropertyValue();

                    if (currentTriple.getObject() instanceof PlainLiteral) {
                        PlainLiteral plain = (PlainLiteral) currentTriple.getObject();
                        if (plain.getLanguage() != null) {
                            jldValue.setLanguage(plain.getLanguage().toString());
                        }
                        strValue = plain.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof TypedLiteral) {
                        TypedLiteral typedObject = (TypedLiteral) currentTriple.getObject();
                        String type = typedObject.getDataType().getUnicodeString();
                        jldValue.setType(type);
                        strValue = typedObject.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof UriRef) {
                        UriRef uriRef = (UriRef) currentTriple.getObject();
                        jldValue.setType(JsonLdCommon.ID);
                        strValue = uriRef.getUnicodeString();
                    }
                   
                    jldValue.setValue(convertValueType(strValue));
                    jldProperty.addValue(jldValue);
                    resource.putProperty(jldProperty);
                }
            }
View Full Code Here


                    if (jldProperty == null) {
                        jldProperty = new JsonLdProperty(property);
                    }
                   
                    String strValue = currentTriple.getObject().toString();
                    JsonLdPropertyValue jldValue = new JsonLdPropertyValue();

                    if (currentTriple.getObject() instanceof PlainLiteral) {
                        PlainLiteral plain = (PlainLiteral) currentTriple.getObject();
                        if (plain.getLanguage() != null) {
                            jldValue.setLanguage(plain.getLanguage().toString());
                        }
                        strValue = plain.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof TypedLiteral) {
                        TypedLiteral typedObject = (TypedLiteral) currentTriple.getObject();
                        String type = typedObject.getDataType().getUnicodeString();
                        jldValue.setType(type);
                        strValue = typedObject.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof UriRef) {
                        UriRef uriRef = (UriRef) currentTriple.getObject();
                        jldValue.setType(JsonLdCommon.ID);
                        strValue = uriRef.getUnicodeString();
                    }
                   
                    jldValue.setValue(convertValueType(strValue));
                    jldProperty.addValue(jldValue);
                    resource.putProperty(jldProperty);
                }
            }
View Full Code Here

                fact = new Fact();
                fact.setFactSchemaURN(schemaURN);
                for (String role : propMap.keySet()) {
                    JsonLdProperty jldProperty = propMap.get(role);
                    if (jldProperty.isSingleValued()) {
                        JsonLdPropertyValue jldValue = jldProperty.getValues().get(0);
                        if (jldValue.getType() != null && jldValue.getType().equals(JsonLdCommon.IRI)) {
                            fact.addRole(role, jsonLd.unCURIE(jldValue.getLiteralValue()));
                        } else {
                            fact.addRole(role, jldValue.getValue().toString());
                        }
                    }
                    else {
                        // TODO Implement multi-valued properties when converting JSON-LD to fact
                        throw new RuntimeException("Sorry, this is not implemented yet!");
View Full Code Here

                    if (jldProperty == null) {
                        jldProperty = new JsonLdProperty(property);
                    }
                   
                    String strValue = currentTriple.getObject().toString();
                    JsonLdPropertyValue jldValue = new JsonLdPropertyValue();

                    if (currentTriple.getObject() instanceof PlainLiteral) {
                        PlainLiteral plain = (PlainLiteral) currentTriple.getObject();
                        if (plain.getLanguage() != null) {
                            jldValue.setLanguage(plain.getLanguage().toString());
                        }
                        strValue = plain.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof TypedLiteral) {
                        TypedLiteral typedObject = (TypedLiteral) currentTriple.getObject();
                        String type = typedObject.getDataType().getUnicodeString();
                        jldValue.setType(type);
                        strValue = typedObject.getLexicalForm();
                    }
                    else if (currentTriple.getObject() instanceof UriRef) {
                        UriRef uriRef = (UriRef) currentTriple.getObject();
                        jldValue.setType(JsonLdCommon.IRI);
                        strValue = uriRef.getUnicodeString();
                    }
                   
                    jldValue.setValue(convertValueType(strValue));
                    jldProperty.addValue(jldValue);
                    resource.putProperty(jldProperty);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.commons.jsonld.JsonLdPropertyValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.