On 11/04/12 01:56, Craig Trim wrote:
I'm trying to list statements in a model, searching by rdfs:label. The
first statement works, and the second one doesn't.
String qLabel = label.concat("@en");
StmtIterator iter2 = model.listStatements((Resource) null,
RDFS.label, (RDFNode) null);
while (iter2.hasNext()) {
Statement stmt = iter2.next();
if (stmt.getObject().toString().equalsIgnoreCase(qLabel)) {
// this works ...
}
}
StmtIterator iter = model.listStatements((Resource) null,
RDFS.label, qLabel);
while (iter.hasNext()) {
list.add(iter.next());
}
Any insight appreciated. Thanks!
The syntax "foo@en" indicates a label "foo" with an "en" language tag
which is not the same thing as a plain label which happens to be spelt
"foo@en".
I assume you have language tags on your labels in which case in the
second version use:
model.listStatements(null, RDFS.label, model.createLiteral(label, "en"))
Dave
lib:
arq-2.8.8.jar, icu4j-3.4.4.jar, iri-0.8.jar, jena-2.6.4-A.jar,
junit-4.5.jar, log4j-1.2.14.jar, lucene-core-2.3.1.jar,
slf4j-api-1.6.4.jar, slf4j-log4j12-1.6.4.jar, stax, api-1.0.1.jar,
tdb-0.8.10.jar, wstx-asl-3.2.9.jar, xercesImpl-2.7.1.jar
O/S:
Microsoft Windows [Version 6.1.7601] 64 bit
JDK:
java version "1.6.0"
Java(TM) SE Runtime Environment (build pwa6460sr9fp2-20110625_01(SR9 FP2))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows 7 amd64-64
jvmwa6460sr9-20110624_85526 (JIT enabled, AOT enabled)
J9VM - 20110624_085526
JIT - r9_20101028_17488ifx17
GC - 20101027_AA)
JCL - 20110530_01