private Object[] convertAttribute(Attribute attr) { String attrName = currentNamespace.qualifiedNameToString(attr.getElementName()); Object value = attr.getValue(); QualifiedName type = attr.getType(); Object attrValue = convertTypedValue(value, type); return tuple(attrName, attrValue); }
static public boolean hasType(org.openprovenance.prov.model.QualifiedName type, Collection<org.openprovenance.prov.model.Attribute> attributes) { for (org.openprovenance.prov.model.Attribute attribute: attributes) { switch (attribute.getKind()) { case PROV_TYPE : if (attribute.getValue().equals(type)) { return true; } break; default : break; } } return false; }
public String optionalAttributes(Collection<Attribute> attrs) { if ((attrs == null) || (attrs.isEmpty())) { return ""; } StringBuffer sb = new StringBuffer(); boolean first = true; for (Attribute attr : attrs) { if (first) { sb.append(symbol(",[") + attr.toNotationString()); first = false; } else { sb.append(symbol(",") + " " + attr.toNotationString()); } } if (!first) sb.append(symbol("]")); return sb.toString(); }
Object aValue=attr.getValue(); if (getName().RDF_LITERAL.equals(attr.getType())&& (aValue instanceof String)) { aValue=vconv.convertToJava(attr.getType(),(String)aValue); switch (attr.getKind()) { case PROV_LABEL: if (lab!=null) { case PROV_LOCATION: if (loc!=null) { loc.getLocation().add(newLocation(aValue,attr.getType())); rol.getRole().add(newRole(aValue,attr.getType())); typ.getType().add(newType(aValue,attr.getType())); aval.setValue(newValue(aValue,attr.getType())); res.getOther().add(newOther(attr.getElementName(), aValue, attr.getType())); break;
static public HashSet<QualifiedName> freeAttributeVariables(Statement statement, ProvFactory pf) { HashSet<QualifiedName> result = new HashSet<QualifiedName>(); Collection<Attribute> ll = pf.getAttributes(statement); for (Attribute attr : ll) { if (pf.getName().PROV_QUALIFIED_NAME.equals(attr.getType())) { Object o = attr.getValue(); if (o instanceof QualifiedName) { // if attribute is constructed // properly, this test should // always return true QualifiedName qn = (QualifiedName) o; if (isVariable(qn)) result.add(qn); } } } return result; }
public String convertValue(Attribute v) { if (v.getValue() instanceof QualifiedName) { QualifiedName name=(QualifiedName) v.getValue(); return htmlify(nonEmptyLocalName(name)); } String label=getPropertyValueFromAny(v); int i=label.lastIndexOf("#"); int j=label.lastIndexOf("/"); return htmlify(label.substring(Math.max(i,j)+1, label.length())); }
final static public org.w3c.dom.Element marshalAttribute(org.openprovenance.prov.model.Attribute attribute) { return marshalTypedValue(attribute, attribute.getElementName()); }
Object aValue=attr.getValue(); if (getName().RDF_LITERAL.equals(attr.getType())&& (aValue instanceof String)) { aValue=vconv.convertToJava(attr.getType(),(String)aValue); switch (attr.getKind()) { case PROV_LABEL: if (lab!=null) { case PROV_LOCATION: if (loc!=null) { loc.getLocation().add(newLocation(aValue,attr.getType())); rol.getRole().add(newRole(aValue,attr.getType())); typ.getType().add(newType(aValue,attr.getType())); aval.setValue(newValue(aValue,attr.getType())); res.getOther().add(newOther(attr.getElementName(), aValue, attr.getType())); break;
static public HashSet<QualifiedName> freeAttributeVariables(Statement statement, ProvFactory pf) { HashSet<QualifiedName> result = new HashSet<QualifiedName>(); Collection<Attribute> ll = pf.getAttributes(statement); for (Attribute attr : ll) { if (pf.getName().PROV_QUALIFIED_NAME.equals(attr.getType())) { Object o = attr.getValue(); if (o instanceof QualifiedName) { // if attribute is constructed // properly, this test should // always return true QualifiedName qn = (QualifiedName) o; if (isVariable(qn)) result.add(qn); } } } return result; }
public String convertValue(Attribute v) { if (v.getValue() instanceof QualifiedName) { QualifiedName name=(QualifiedName) v.getValue(); return htmlify(nonEmptyLocalName(name)); } String label=getPropertyValueFromAny(v); int i=label.lastIndexOf("#"); int j=label.lastIndexOf("/"); return htmlify(label.substring(Math.max(i,j)+1, label.length())); }
final static public org.w3c.dom.Element marshalAttribute(org.openprovenance.prov.model.Attribute attribute) { return marshalTypedValue(attribute, attribute.getElementName()); }
private Object[] convertAttribute(Attribute attr) { String attrName = currentNamespace.qualifiedNameToString(attr.getElementName()); Object value = attr.getValue(); QualifiedName type = attr.getType(); Object attrValue = convertTypedValue(value, type); return tuple(attrName, attrValue); }
public String getPropertyValueFromAny (Attribute o) { Object val=o.getValue(); if (val instanceof QualifiedName) { QualifiedName q=(QualifiedName)val; return q.getNamespaceURI() + q.getLocalPart(); } else { return "" + val; } }
public String getPropertyFromAny (Attribute o) { return o.getElementName().getUri(); }
static public boolean hasType(org.openprovenance.prov.model.QualifiedName type, Collection<org.openprovenance.prov.model.Attribute> attributes) { for (org.openprovenance.prov.model.Attribute attribute: attributes) { switch (attribute.getKind()) { case PROV_TYPE : if (attribute.getValue().equals(type)) { return true; } break; default : break; } } return false; }
public String optionalAttributes(Collection<Attribute> attrs) { if ((attrs == null) || (attrs.isEmpty())) { return ""; } StringBuffer sb = new StringBuffer(); boolean first = true; for (Attribute attr : attrs) { if (first) { sb.append(symbol(",[") + attr.toNotationString()); first = false; } else { sb.append(symbol(",") + " " + attr.toNotationString()); } } if (!first) sb.append(symbol("]")); return sb.toString(); }
QualifiedName type = attr.getType(); QualifiedName pred = onto.convertToRdf(attr.getElementName()); // FIXME: if (attr.getValue() instanceof LangString) { LangString iString = (LangString) attr.getValue(); value = iString.getValue(); lit = gb.newLiteral(value, iString.getLang()); gb.assertStatement(gb.createDataProperty(r, pred, lit)); } else if (attr.getValue() instanceof QualifiedName) { QualifiedName name = (QualifiedName) attr.getValue(); value = attr.getValue().toString(); lit = gb.newLiteral(value, type); gb.assertStatement(gb.createDataProperty(r, pred, lit));
public String getPropertyValueFromAny (Attribute o) { Object val=o.getValue(); if (val instanceof QualifiedName) { QualifiedName q=(QualifiedName)val; return q.getNamespaceURI() + q.getLocalPart(); } else { return "" + val; } }
public String getPropertyFromAny (Attribute o) { return o.getElementName().getUri(); }
QualifiedName type = attr.getType(); QualifiedName pred = onto.convertToRdf(attr.getElementName()); // FIXME: if (attr.getValue() instanceof LangString) { LangString iString = (LangString) attr.getValue(); value = iString.getValue(); lit = gb.newLiteral(value, iString.getLang()); gb.assertStatement(gb.createDataProperty(r, pred, lit)); } else if (attr.getValue() instanceof QualifiedName) { QualifiedName name = (QualifiedName) attr.getValue(); value = attr.getValue().toString(); lit = gb.newLiteral(value, type); gb.assertStatement(gb.createDataProperty(r, pred, lit));