/** Answer the label of this blank node or throw an UnsupportedOperationException if it's not blank. */ public String getBlankNodeLabel() { return getBlankNodeId().getLabelString(); }
/** Answer the label of this blank node or throw an UnsupportedOperationException if it's not blank. */ public String getBlankNodeLabel() { return getBlankNodeId().getLabelString(); }
public static String toXmlStringBlank(Node node) { String label = node.getBlankNodeId().getLabelString(); String result = "<bnode>" + label + "</bnode>"; return result; }
protected String genStringForNode(Node n) { if ( bNodesAsFakeURIs && n.isBlank() ) return "<_:"+n.getBlankNodeId().getLabelString()+">" ; return prefixString+(bNodeCounter++) ; }
@Override public String encode(Node node) { if ( node.isBlank() ) return "_:"+node.getBlankNodeId().getLabelString() ; String s = FmtUtils.stringForNode(node, prefixMapping) ; return s ; }
public void testGetBlankNodeIdFails( Node n ) { try { n.getBlankNodeId(); fail( n.getClass() + " should fail getName()" ); } catch (UnsupportedOperationException e) {} }
@Override public NodeValue exec(NodeValue v) { Node n = v.asNode() ; if ( ! n.isBlank() ) throw new ExprEvalException("bnode: not a blank node") ; NodeValue nv = NodeValue.makeString(n.getBlankNodeId().getLabelString()) ; return nv ; } }
public static String nodeToLex(Node node) { if ( node.isURI() ) return node.getURI() ; if ( node.isLiteral() ) return node.getLiteralLexicalForm() ; if ( node.isBlank() ) return node.getBlankNodeId().getLabelString() ; throw new SDBException("Can't create lexical representation for "+node) ; }
private Resource getResource(Node node) throws InvalidSPDXAnalysisException { Resource s; if (node.isURI()) { s = model.createResource(node.getURI()); } else if (node.isBlank()) { s = model.createResource(new AnonId(node.getBlankNodeId())); } else { throw(new InvalidSPDXAnalysisException("Node can not be a literal")); } return s; }
private Resource getResource(Node node) throws InvalidSPDXAnalysisException { Resource s; if (node.isURI()) { s = model.createResource(node.getURI()); } else if (node.isBlank()) { s = model.createResource(new AnonId(node.getBlankNodeId())); } else { throw(new InvalidSPDXAnalysisException("Node can not be a literal")); } return s; }
private Resource getResource(Node node) throws InvalidSPDXAnalysisException { Resource s; if (node.isURI()) { s = model.createResource(node.getURI()); } else if (node.isBlank()) { s = model.createResource(new AnonId(node.getBlankNodeId())); } else { throw(new InvalidSPDXAnalysisException("Node can not be a literal")); } return s; }
public void testGetBlankNodeLabelString() { Node n = NodeFactory.createBlankNode(); assertEquals( n.getBlankNodeId().getLabelString(), n.getBlankNodeLabel() ); }
public void testGetBlankNodeLabelString() { Node n = NodeFactory.createBlankNode(); assertEquals( n.getBlankNodeId().getLabelString(), n.getBlankNodeLabel() ); }
/** Test that anonymous nodes are created with the correct labels */ public void testCreateBlankNode() { String idA = "_xxx", idB = "_yyy"; Node a = NodeCreateUtils.create( idA ), b = NodeCreateUtils.create( idB ); assertTrue( "both must be bnodes", a.isBlank() && b.isBlank() ); assertEquals( BlankNodeId.create( idA ), a.getBlankNodeId() ); assertEquals( BlankNodeId.create( idB ), b.getBlankNodeId() ); }
/** Test that anonymous nodes are created with the correct labels */ public void testCreateBlankNode() { String idA = "_xxx", idB = "_yyy"; Node a = NodeCreateUtils.create( idA ), b = NodeCreateUtils.create( idB ); assertTrue( "both must be bnodes", a.isBlank() && b.isBlank() ); assertEquals( BlankNodeId.create( idA ), a.getBlankNodeId() ); assertEquals( BlankNodeId.create( idB ), b.getBlankNodeId() ); }
private void processSubject(Resource subjectResource) throws IOException { write(" \""); if (subjectResource.isAnon()) { write("_:"); write(escape(subjectResource.asNode().getBlankNodeId().getLabelString())); } else { write(escape(subjectResource.getURI())); } writeLine("\" : {"); processProperties(subjectResource); write(" }"); }
/** test that the label of a Node can be retrieved from that Node in a way appropriate to that Node. */ public void testLabels() { BlankNodeId id = BlankNodeId.create(); assertEquals( "get URI value", U, NodeFactory.createURI( U ).getURI() ); assertEquals( "get blank value", id, NodeFactory.createBlankNode( id ).getBlankNodeId() ); assertEquals( "get literal value", L, NodeFactory.createLiteral( L ).getLiteral() ); assertEquals( "get variable name", N, NodeFactory.createVariable( N ).getName() ); }
/** test that the label of a Node can be retrieved from that Node in a way appropriate to that Node. */ public void testLabels() { BlankNodeId id = BlankNodeId.create(); assertEquals( "get URI value", U, NodeFactory.createURI( U ).getURI() ); assertEquals( "get blank value", id, NodeFactory.createBlankNode( id ).getBlankNodeId() ); assertEquals( "get literal value", L, NodeFactory.createLiteral( L ).getLiteral() ); assertEquals( "get variable name", N, NodeFactory.createVariable( N ).getName() ); }
public void testBlanks() { assertTrue( "anonymous nodes are blank", NodeFactory.createBlankNode().isBlank() ); assertFalse( "anonymous nodes aren't literal", NodeFactory.createBlankNode().isLiteral() ); assertFalse( "anonymous nodes aren't URIs", NodeFactory.createBlankNode().isURI() ); assertFalse( "anonymous nodes aren't variables", NodeFactory.createBlankNode().isVariable() ); assertEquals( "anonymous nodes have the right id", NodeFactory.createBlankNode(A).getBlankNodeId(), A ); }
public void testBlanks() { assertTrue( "anonymous nodes are blank", NodeFactory.createBlankNode().isBlank() ); assertFalse( "anonymous nodes aren't literal", NodeFactory.createBlankNode().isLiteral() ); assertFalse( "anonymous nodes aren't URIs", NodeFactory.createBlankNode().isURI() ); assertFalse( "anonymous nodes aren't variables", NodeFactory.createBlankNode().isVariable() ); assertEquals( "anonymous nodes have the right id", NodeFactory.createBlankNode(A).getBlankNodeId(), A ); }