if (verifyData) {
checkPropertyEltName(namespaceURI, localName, qName);
}
// Get the URI of the property
URIReference propURI;
if ("".equals(namespaceURI)) {
// no namespace URI
sendError("unqualified property element <" + qName + "> not allowed");
// Use base URI as namespace:
propURI = buildResourceFromLocalName(localName);
} else {
propURI = createURIReference(namespaceURI + localName);
}
// List expansion rule
if (propURI.equals(RDF_LI)) {
NodeElement subject = (NodeElement) peekStack(0);
propURI = createURIReference(BASE_URI_STR + "_" + 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(BASE_URI_STR, "ID");
if (null != id) {
URIReference reifURI = buildURIFromID(id.getValue());
predicate.setReificationURI(reifURI);
}
// Check for presence of rdf:parseType attribute
Att parseType = atts.removeAtt(BASE_URI_STR, "parseType");
if (null != parseType) {
if (verifyData) {
checkNoMoreAtts(atts);
}
String parseTypeValue = parseType.getValue();
if ("Resource".equals(parseTypeValue)) {
BlankNode 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 ("Collection".equals(parseTypeValue)) {
if (isEmptyElt) {
NodeElement subject = (NodeElement) peekStack(1);
reportStatement(subject.getResource(), propURI, RDF_NIL);
handleReification(RDF_NIL);
} else {
predicate.setParseCollection(true);
}
} else {
// other parseType
if (!"Literal".equals(parseTypeValue)) {
sendWarning("unknown parseType: " + parseType.getValue());
}
if (isEmptyElt) {
NodeElement subject = (NodeElement) peekStack(1);
Literal lit = createLiteral("", null, RDF.XML_LITERAL.toString());
reportStatement(subject.getResource(), propURI, lit);
handleReification(lit);
} else {
// The next string is an rdf:XMLLiteral
predicate.setDatatype(RDF.XML_LITERAL.toString());
saxFilter.setParseLiteralMode();
}
}
} else if (isEmptyElt) {
// empty element without an rdf:parseType attribute
if (0 == atts.size() || 1 == atts.size() && atts.getAtt(RDF.BASE_URI.toString(), "datatype") != null) {
// element had no attributes, or only the optional rdf:ID
NodeElement subject = (NodeElement) peekStack(1);
Literal lit = createLiteral("", xmlLang, null);
reportStatement(subject.getResource(), propURI, lit);
handleReification(lit);
} else {
// Create resource for the statement's object.
SubjectNode 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, (ObjectNode) resourceRes);
handleReification((ObjectNode) resourceRes);
Att type = atts.removeAtt(BASE_URI_STR, "type");
if (null != type) {
// rdf:type attribute, value is a URI-reference
URIReference className = buildURIFromReference(type.getValue());
reportStatement(resourceRes, RDF_TYPE, className);
}
processSubjectAtts(resourceElt, atts);
}