if (verifyData()) {
checkPropertyEltName(namespaceURI, localName, qName);
}
// Get the URI of the property
URI propURI = null;
if (namespaceURI.equals("")) {
// no namespace URI
reportError("unqualified property element <" + qName + "> not allowed");
// Use base URI as namespace:
propURI = buildResourceFromLocalName(localName);
}
else {
propURI = createURI(namespaceURI + localName);
}
// List expansion rule
if (propURI.equals(RDF.LI)) {
NodeElement subject = (NodeElement)peekStack(0);
propURI = createURI(RDF.NAMESPACE + "_" + subject.getNextLiCounter());
}
// Push the property on the stack.
PropertyElement predicate = new PropertyElement(propURI);
elementStack.push(predicate);
// Check if property has a reification ID
Att id = atts.removeAtt(RDF.NAMESPACE, "ID");
if (id != null) {
URI reifURI = buildURIFromID(id.getValue());
predicate.setReificationURI(reifURI);
}
// Check for presence of rdf:parseType attribute
Att parseType = atts.removeAtt(RDF.NAMESPACE, "parseType");
if (parseType != null) {
if (verifyData()) {
checkNoMoreAtts(atts);
}
String parseTypeValue = parseType.getValue();
if (parseTypeValue.equals("Resource")) {
BNode objectResource = createBNode();
NodeElement subject = (NodeElement)peekStack(1);
reportStatement(subject.getResource(), propURI, objectResource);
if (isEmptyElt) {
handleReification(objectResource);
}
else {
NodeElement object = new NodeElement(objectResource);
object.setIsVolatile(true);
elementStack.push(object);
}
}
else if (parseTypeValue.equals("Collection")) {
if (isEmptyElt) {
NodeElement subject = (NodeElement)peekStack(1);
reportStatement(subject.getResource(), propURI, RDF.NIL);
handleReification(RDF.NIL);
}
else {
predicate.setParseCollection(true);
}
}
else {
// other parseType
if (!parseTypeValue.equals("Literal")) {
reportWarning("unknown parseType: " + parseType.getValue());
}
if (isEmptyElt) {
NodeElement subject = (NodeElement)peekStack(1);
Literal lit = createLiteral("", null, RDF.XMLLITERAL);
reportStatement(subject.getResource(), propURI, lit);
handleReification(lit);
}
else {
// The next string is an rdf:XMLLiteral
predicate.setDatatype(RDF.XMLLITERAL);
saxFilter.setParseLiteralMode();
}
}
}
// parseType == null
else if (isEmptyElt) {
// empty element without an rdf:parseType attribute
// Note: we handle rdf:datatype attributes here to allow datatyped
// empty strings in documents. The current spec does have a
// production rule that matches this, which is likely to be an
// omission on its part.
Att datatype = atts.getAtt(RDF.NAMESPACE, "datatype");
if (atts.size() == 0 || atts.size() == 1 && datatype != null) {
// element had no attributes, or only the optional
// rdf:ID and/or rdf:datatype attributes.
NodeElement subject = (NodeElement)peekStack(1);
URI dtURI = null;
if (datatype != null) {
dtURI = createURI(datatype.getValue());
}
Literal lit = createLiteral("", xmlLang, dtURI);
reportStatement(subject.getResource(), propURI, lit);
handleReification(lit);
}
else {
// Create resource for the statement's object.
Resource resourceRes = getPropertyResource(atts);
// All special rdf attributes have been checked/removed.
if (verifyData()) {
checkRDFAtts(atts);
}
NodeElement resourceElt = new NodeElement(resourceRes);
NodeElement subject = (NodeElement)peekStack(1);
reportStatement(subject.getResource(), propURI, resourceRes);
handleReification(resourceRes);
Att type = atts.removeAtt(RDF.NAMESPACE, "type");
if (type != null) {
// rdf:type attribute, value is a URI-reference
URI className = resolveURI(type.getValue());
reportStatement(resourceRes, RDF.TYPE, className);
}
processSubjectAtts(resourceElt, atts);
}
}
else {
// Not an empty element, sub elements will follow.
// Check for rdf:datatype attribute
Att datatype = atts.removeAtt(RDF.NAMESPACE, "datatype");
if (datatype != null) {
URI dtURI = resolveURI(datatype.getValue());
predicate.setDatatype(dtURI);
}
// No more attributes are expected.
if (verifyData()) {