Java Code Examples for com.hp.hpl.jena.rdf.model.Statement#getObject()

The following examples show how to use com.hp.hpl.jena.rdf.model.Statement#getObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WP2RDFXMLWriter.java    From GeoTriples with Apache License 2.0 6 votes vote down vote up
protected void writePredicate(Statement stmt, final PrintWriter writer) {
	final Property predicate = stmt.getPredicate();
	final RDFNode object = stmt.getObject();

	writer.print(space
			+ space
			+ "<"
			+ startElementTag(predicate.getNameSpace(),
					predicate.getLocalName()));

	if (object instanceof Resource) {
		writer.print(" ");
		writeResourceReference(((Resource) object), writer);
		writer.println("/>");
	} else {
		writeLiteral((Literal) object, writer);
		writer.println("</"
				+ endElementTag(predicate.getNameSpace(),
						predicate.getLocalName()) + ">");
	}
}
 
Example 2
Source File: OpenCycOntology.java    From xcurator with Apache License 2.0 5 votes vote down vote up
public String getLabelForResource(String uri) {
    Resource subject = model.createResource(uri);
    Statement stmt = subject.getProperty(RDFS.label);
    if (stmt != null) {
        RDFNode object = stmt.getObject();
        return object == null ? "" : object.asLiteral().getString();
    } else {
        return "";
    }
}