Search in sources :

Example 1 with NodeType

use of org.apache.jena.tdb.store.NodeType in project jena by apache.

the class NodeLib method setHash.

public static void setHash(Hash h, Node n) {
    NodeType nt = NodeType.lookup(n);
    switch(nt) {
        case URI:
            hash(h, n.getURI(), null, null, nt);
            return;
        case BNODE:
            hash(h, n.getBlankNodeLabel(), null, null, nt);
            return;
        case LITERAL:
            String dt = n.getLiteralDatatypeURI();
            if (NodeUtils.isSimpleString(n) || NodeUtils.isLangString(n)) {
                // RDF 1.1 : No datatype for:
                //   xsd:String as simple literals
                //   rdf:langString and @ 
                dt = null;
            }
            hash(h, n.getLiteralLexicalForm(), n.getLiteralLanguage(), dt, nt);
            return;
        case OTHER:
            throw new TDBException("Attempt to hash something strange: " + n);
    }
    throw new TDBException("NodeType broken: " + n);
}
Also used : NodeType(org.apache.jena.tdb.store.NodeType) TDBException(org.apache.jena.tdb.TDBException)

Aggregations

TDBException (org.apache.jena.tdb.TDBException)1 NodeType (org.apache.jena.tdb.store.NodeType)1