/** A displayable string for an RDFNode. Includes common abbreviations */ public static String displayStr(RDFNode obj) { return displayStr(obj.asNode()) ; }
/** * Return a simplified print string for an RDFNode. */ public static String print(RDFNode node) { if (node == null) return "null"; return print(node.asNode()); }
/** Answer a string describing <code>object</code>, quoting it if it is a literal. */ protected String objectString( RDFNode object ) { return object.asNode().toString( null, true ); }
public static Map<Var, Node> convert(Map<String, ? extends RDFNode> substitutions) { return substitutions.entrySet().stream() .collect(Collectors.toMap(e -> Var.alloc(e.getKey()), e -> e.getValue().asNode())); } }
/** * Appends a Node to the command text as a constant using appropriate * formatting * * @param n * Node to append */ public void appendNode(RDFNode n) { this.appendNode(n.asNode()); }
@Override public Node asNode() throws ReadDeniedException, AuthenticationRequiredException { checkRead(); return holder.getBaseItem().asNode(); }
@Override public Model remove( Resource s, Property p, RDFNode o ) { graph.delete( Triple.create( s.asNode(), p.asNode(), o.asNode() ) ); return this; }
@Override public Model add( Resource s, Property p, RDFNode o ) { modelReifier.noteIfReified( s, p, o ); graph.add( Triple.create( s.asNode(), p.asNode(), o.asNode() ) ); return this; }
private void testPresentAsRDFNode( Node n, Class<? extends RDFNode> nodeClass ) { RDFNode r = model.asRDFNode( n ); assertSame( n, r.asNode() ); assertInstanceOf( nodeClass, r ); }
private void testPresentAsRDFNode( final Node n, final Class<? extends RDFNode> nodeClass ) { final RDFNode r = model.asRDFNode(n); Assert.assertSame(n, r.asNode()); JenaTestBase.assertInstanceOf(nodeClass, r); }
private void checkCreateNewList(final RDFNode value, final Resource tail) throws AddDeniedException, AuthenticationRequiredException { checkCreate(new Triple(SecurityEvaluator.FUTURE, listFirst().asNode(), value.asNode())); checkCreate(new Triple(SecurityEvaluator.FUTURE, listRest().asNode(), tail.asNode())); }
@Override public SecuredRDFList with(final RDFNode value) throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException { checkUpdate(); checkCreate(new Triple(SecurityEvaluator.FUTURE, listFirst().asNode(), value.asNode())); return SecuredRDFListImpl.getInstance(getModel(), holder.getBaseItem() .with(value)); } }
@Override public char getChar(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final char retval = holder.getBaseItem().getChar(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), asObject(retval).asNode())); return retval; }
@Override public double getDouble(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final double retval = holder.getBaseItem().getDouble(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), asObject(retval).asNode())); return retval; }
@Override public float getFloat(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final float retval = holder.getBaseItem().getFloat(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), asObject(retval).asNode())); return retval; }
@Override public SecuredRDFNode getObject(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final RDFNode retval = holder.getBaseItem().getObject(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), retval.asNode())); return SecuredRDFNodeImpl.getInstance(getModel(), retval); }
@Override public SecuredSeq remove(final int index) throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException { checkUpdate(); final RDFNode rdfNode = holder.getBaseItem().getObject(index); if (rdfNode != null) { checkDelete(new Triple(holder.getBaseItem().asNode(), RDF.li(index) .asNode(), rdfNode.asNode())); holder.getBaseItem().remove(index); } return holder.getSecuredItem(); }
private void checkModel(Model model2, String label) { assertEquals(1, model2.size()); Node n = model2.listStatements().next().getObject().asNode(); assertTrue(n.isBlank()); assertEquals(label, n.getBlankNodeLabel()); }
public void testToStatement() { final Triple t = GraphTestBase.triple("a P b"); final Statement s = model.asStatement(t); Assert.assertEquals(GraphTestBase.node("a"), s.getSubject().asNode()); Assert.assertEquals(GraphTestBase.node("P"), s.getPredicate().asNode()); Assert.assertEquals(GraphTestBase.node("b"), s.getObject().asNode()); }