1 |
//(c): Matti Katila |
//(c): Matti Katila |
2 |
|
|
3 |
package org.fenfire.util; |
package org.fenfire.util; |
4 |
|
import org.fenfire.vocab.*; |
5 |
import com.hp.hpl.mesa.rdf.jena.vocabulary.RDF; |
import com.hp.hpl.mesa.rdf.jena.vocabulary.RDF; |
6 |
import com.hp.hpl.mesa.rdf.jena.model.*; |
import com.hp.hpl.mesa.rdf.jena.model.*; |
7 |
import com.hp.hpl.mesa.rdf.jena.common.*; |
import com.hp.hpl.mesa.rdf.jena.common.*; |
54 |
pa("Exception ocurred!: "+e); |
pa("Exception ocurred!: "+e); |
55 |
throw new Error("ShortRDF has RDFException!"); |
throw new Error("ShortRDF has RDFException!"); |
56 |
}} |
}} |
57 |
|
|
58 |
|
|
59 |
|
/** Check if node is specified type |
60 |
|
*/ |
61 |
|
public static boolean isNodeType(Model model, RDFNode node, RDFNode type) |
62 |
|
{ try { |
63 |
|
Selector selector = new SelectorImpl((Resource)node, RDF.type, (RDFNode)null); |
64 |
|
StmtIterator iter = model.listStatements(selector); |
65 |
|
while (iter.hasNext()) { |
66 |
|
Statement stmt = iter.next(); |
67 |
|
if ((RDFNode)stmt.getObject() == type) return true; |
68 |
|
} |
69 |
|
return false; |
70 |
|
} catch (RDFException e) { |
71 |
|
pa("Exception ocurred!: "+e); |
72 |
|
throw new Error("ShortRDF has RDFException!"); |
73 |
|
}} |
74 |
|
|
75 |
} |
} |