public String getLabel(HasOther e) { List<LangString> labels = ((HasLabel) e).getLabel(); if ((labels == null) || (labels.isEmpty())) return null; if (e instanceof HasLabel) return labels.get(0).getValue(); return "pFact: label TODO"; }
public String getLabel(HasOther e) { List<LangString> labels = ((HasLabel) e).getLabel(); if ((labels == null) || (labels.isEmpty())) return null; if (e instanceof HasLabel) return labels.get(0).getValue(); return "pFact: label TODO"; }
private String convertValueToString(Object value, Object convertedValue) { if (convertedValue instanceof String) { return (String) convertedValue; } if (convertedValue instanceof QualifiedName) return currentNamespace.qualifiedNameToString((QualifiedName) convertedValue); if (convertedValue instanceof LangString) { LangString iStr = (LangString) convertedValue; return iStr.getValue(); } if (convertedValue instanceof byte[]) { return (String) value; } return (String) value; }
private String convertValueToString(Object value, Object convertedValue) { if (convertedValue instanceof String) { return (String) convertedValue; } if (convertedValue instanceof QualifiedName) return currentNamespace.qualifiedNameToString((QualifiedName) convertedValue); if (convertedValue instanceof LangString) { LangString iStr = (LangString) convertedValue; return iStr.getValue(); } if (convertedValue instanceof byte[]) { return (String) value; } return (String) value; }
public static Object convertValueToBean(Object o, QualifiedName type, Hashtable<String, String> context) { if (o instanceof Integer) return o; if (o instanceof Float) return o; if (o instanceof QualifiedName) { QualifiedName qn=(QualifiedName)o; Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@id",qn.getPrefix() + ":" + qn.getLocalPart()); context.put(qn.getPrefix(),qn.getNamespaceURI()); return table; } if (o instanceof LangString) { LangString qn=(LangString)o; Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@language",qn.getLang()); table.put("@value",qn.getValue()); return table; } if (o instanceof String) { if ((type==null) || (type.getUri().equals(NamespacePrefixMapper.XSD_NS+"string"))) { return o; } else { Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@type",type.toString()); table.put("@value",o.toString()); return table; } } throw new UnsupportedOperationException("type is " + o); }
public static Object convertValueToBean(Object o, QualifiedName type, Hashtable<String, String> context) { if (o instanceof Integer) return o; if (o instanceof Float) return o; if (o instanceof QualifiedName) { QualifiedName qn=(QualifiedName)o; Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@id",qn.getPrefix() + ":" + qn.getLocalPart()); context.put(qn.getPrefix(),qn.getNamespaceURI()); return table; } if (o instanceof LangString) { LangString qn=(LangString)o; Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@language",qn.getLang()); table.put("@value",qn.getValue()); return table; } if (o instanceof String) { if ((type==null) || (type.getUri().equals(NamespacePrefixMapper.XSD_NS+"string"))) { return o; } else { Hashtable<String,String> table=new Hashtable<String,String>(); table.put("@type",type.toString()); table.put("@value",o.toString()); return table; } } throw new UnsupportedOperationException("type is " + o); }
private Object convertTypedValue(Object value, QualifiedName type) { String datatype = currentNamespace.qualifiedNameToString(type); Object result; if (value instanceof QualifiedName) { result = typedLiteral(currentNamespace.qualifiedNameToString((QualifiedName) value), datatype, null); } else if (value instanceof LangString) { LangString iStr = (LangString) value; String lang = iStr.getLang(); if (lang != null) { // If 'lang' is defined result = typedLiteral(iStr.getValue(), null, lang); } else { // Otherwise, just return the string result = iStr.getValue(); } } else { result = typedLiteral(value.toString(), datatype, null); } return result; }
private Object convertTypedValue(Object value, QualifiedName type) { String datatype = currentNamespace.qualifiedNameToString(type); Object result; if (value instanceof QualifiedName) { result = typedLiteral(currentNamespace.qualifiedNameToString((QualifiedName) value), datatype, null); } else if (value instanceof LangString) { LangString iStr = (LangString) value; String lang = iStr.getLang(); if (lang != null) { // If 'lang' is defined result = typedLiteral(iStr.getValue(), null, lang); } else { // Otherwise, just return the string result = iStr.getValue(); } } else { result = typedLiteral(value.toString(), datatype, null); } return result; }
public static String valueToNotationString(Object val, org.openprovenance.prov.model.QualifiedName xsdType) { if (val instanceof LangString) { LangString istring = (LangString) val; return "\"" + istring.getValue() + ((istring.getLang()==null) ? "\"" : "\"@" + istring.getLang()) + (((xsdType==null)||(xsdType.getUri().equals(internationalizedStringUri)))? "" : " %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType)); } else if (val instanceof QualifiedName) { QualifiedName qn = (QualifiedName) val; return "'" + Namespace.qualifiedNameToStringWithNamespace(qn) + "'"; } else if (val instanceof String) { String s=(String)val; if (s.contains("\n")) { return "\"\"\"" + escape(s) + "\"\"\"" ; } else { //FIXME: It's here that we should detect an int and generate the compact form: e.g. 1 instand of 1 %% xsd:int // However dictionaries failed to be parsed then //if (xsdType.getLocalPart().equals("int")) { //FIXME:need to properly compare with xsd:int // return s; //} else { return "\"" + escape(s) + ((xsdType==null)? "\"" : "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType)); //} } } else { // We should never be here! return "\"" + val + "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType); } }
final static public org.w3c.dom.Element marshalTypedValue(org.openprovenance.prov.model.TypedValue attribute, QualifiedName elementName) { Object value = attribute.getValue(); QualifiedName type = attribute.getType(); if (value instanceof LangString) { LangString istring = ((LangString) value); return newElement(elementName, istring.getValue(), attribute.getType(), istring.getLang()); } else if (value instanceof QualifiedName) { return newElement(elementName, (QualifiedName) value); } else if (type.getNamespaceURI().equals(RDF_NAMESPACE) && type.getLocalPart().equals(XML_LITERAL)) { return newElement(elementName, (org.w3c.dom.Element) attribute.getConvertedValue()); } else { return newElement(elementName, value.toString(), attribute.getType()); } }
public static String valueToNotationString(Object val, org.openprovenance.prov.model.QualifiedName xsdType) { if (val instanceof LangString) { LangString istring = (LangString) val; return "\"" + istring.getValue() + ((istring.getLang()==null) ? "\"" : "\"@" + istring.getLang()) + (((xsdType==null)||(xsdType.getUri().equals(internationalizedStringUri)))? "" : " %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType)); } else if (val instanceof QualifiedName) { QualifiedName qn = (QualifiedName) val; return "'" + Namespace.qualifiedNameToStringWithNamespace(qn) + "'"; } else if (val instanceof String) { String s=(String)val; if (s.contains("\n")) { return "\"\"\"" + escape(s) + "\"\"\"" ; } else { //FIXME: It's here that we should detect an int and generate the compact form: e.g. 1 instand of 1 %% xsd:int // However dictionaries failed to be parsed then //if (xsdType.getLocalPart().equals("int")) { //FIXME:need to properly compare with xsd:int // return s; //} else { return "\"" + escape(s) + ((xsdType==null)? "\"" : "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType)); //} } } else { // We should never be here! return "\"" + val + "\" %% " + Namespace.qualifiedNameToStringWithNamespace(xsdType); } }
final static public org.w3c.dom.Element marshalTypedValue(org.openprovenance.prov.model.TypedValue attribute, QualifiedName elementName) { Object value = attribute.getValue(); QualifiedName type = attribute.getType(); if (value instanceof LangString) { LangString istring = ((LangString) value); return newElement(elementName, istring.getValue(), attribute.getType(), istring.getLang()); } else if (value instanceof QualifiedName) { return newElement(elementName, (QualifiedName) value); } else if (type.getNamespaceURI().equals(RDF_NAMESPACE) && type.getLocalPart().equals(XML_LITERAL)) { return newElement(elementName, (org.w3c.dom.Element) attribute.getConvertedValue()); } else { return newElement(elementName, value.toString(), attribute.getType()); } }
private LITERAL valueToLiteral(TypedValue val) { LITERAL lit = null; String value; if (val.getValue() instanceof QualifiedName) { value = Namespace.qualifiedNameToStringWithNamespace((QualifiedName) val.getValue()); lit = gb.newLiteral(value, val.getType()); } else if (val.getValue() instanceof LangString) { LangString iString=(LangString) val.getValue(); lit = gb.newLiteral(iString.getValue(), iString.getLang()); } else { value = val.getValue().toString(); lit = gb.newLiteral(value, val.getType()); } return lit; }
private LITERAL valueToLiteral(TypedValue val) { LITERAL lit = null; String value; if (val.getValue() instanceof QualifiedName) { value = Namespace.qualifiedNameToStringWithNamespace((QualifiedName) val.getValue()); lit = gb.newLiteral(value, val.getType()); } else if (val.getValue() instanceof LangString) { LangString iString=(LangString) val.getValue(); lit = gb.newLiteral(iString.getValue(), iString.getLang()); } else { value = val.getValue().toString(); lit = gb.newLiteral(value, val.getType()); } return lit; }
/** * Gets the value of the test property. * * @return * possible object is * {@link AValue } * */ @Embedded public AValue getValueItem() { if ((avalue==null) && (value!=null)) { if (type==null) { avalue=SQLValueConverter.convertToAValue(vc.getXsdType(value), value); } else if (value instanceof LangString) { avalue=SQLValueConverter.convertToAValue(type, ((LangString) value).getValue()); } else if (value instanceof org.openprovenance.prov.model.QualifiedName) { avalue=SQLValueConverter.convertToAValue(type, (QualifiedName) value); } else { avalue=SQLValueConverter.convertToAValue(type, vc.convertToJava(type, (String)value)); } } return avalue; }
label=label+" <TR>\n"; label=label+" <TD align=\"left\">" + "label" + ":</TD>\n"; label=label+" <TD align=\"left\">" + htmlify(lab.getValue()) + "</TD>\n"; label=label+" </TR>\n";
label=label+" <TR>\n"; label=label+" <TD align=\"left\">" + "label" + ":</TD>\n"; label=label+" <TD align=\"left\">" + htmlify(lab.getValue()) + "</TD>\n"; label=label+" </TR>\n";
value = iString.getValue(); lit = gb.newLiteral(value, iString.getLang()); gb.assertStatement(gb.createDataProperty(r, pred, lit));
value = iString.getValue(); lit = gb.newLiteral(value, iString.getLang()); gb.assertStatement(gb.createDataProperty(r, pred, lit));