/** * {@inheritDoc} */ @Override public RDFNode asRDFNode(Node n) { return super.object.asRDFNode(n); }
public RDFNode asRDFNode(Node n) { return model.asRDFNode(n); }
static public RDFNode makeRDFNode(ATermAppl term, Model model) { return model.asRDFNode( makeGraphNode( term ) ); }
static public Literal makeLiteral(ATermAppl literal, Model model) { return (Literal) model.asRDFNode( makeGraphLiteral( literal ) ); }
static public Resource makeResource(ATermAppl term, Model model) { return (Resource) model.asRDFNode( makeGraphResource( term ) ); }
public static RDFNode generateRDFBlankNode(){ return ModelFactory.createDefaultModel().asRDFNode(NodeFactory.createAnon()); }
public static RDFNode convertGraphNodeToRDFNode(Node n, Model model) { if ( n.isVariable() ) throw new QueryException("Variable: "+n) ; // Best way. if ( model != null ) return model.asRDFNode(n) ; if ( n.isLiteral() ) return new LiteralImpl(n, null) ; if ( n.isURI() || n.isBlank() ) return new ResourceImpl(n, null) ; throw new ARQInternalErrorException("Unknown node type for node: "+n) ; }
public static RDFNode convertGraphNodeToRDFNode(Node n, Model model) { if ( n.isVariable() ) throw new QueryException("Variable: "+n) ; // Best way. if ( model != null ) return model.asRDFNode(n) ; if ( n.isLiteral() ) return new LiteralImpl(n, null) ; if ( n.isURI() || n.isBlank() ) return new ResourceImpl(n, null) ; throw new ARQInternalErrorException("Unknown node type for node: "+n) ; }
@Override public boolean hasResource(Resource resource) { if (resource == null) { return false; } Model graph = null; GraphConnection graphConnection = null; try { graphConnection = openGraph(); graph = graphConnection.getGraph(); graph.enterCriticalSection(Lock.READ); com.hp.hpl.jena.graph.Node jenaNodeInst = getJenaNode(resource); RDFNode jenaNode = graph.asRDFNode(jenaNodeInst); return graph.containsResource(jenaNode); } finally { if (graph != null) { graph.leaveCriticalSection(); } if (graphConnection != null) { graphConnection.close(); } } }
description.append( "Implicated node: " + PrintUtil.print(rFunc.getArgs()[j]) + "\n"); RDFNode culprit = forConversion.asRDFNode( t.getSubject() ); report.add(nature.equalsIgnoreCase("error"), type, description.toString(), culprit);
/** * Gets Jena statement selector corresponding to the NXRelations statement. * * @param graph the jena graph * @param nuxStatement NXRelations statement * @return jena statement selector */ private static SimpleSelector getJenaSelector(Model graph, Statement nuxStatement) { com.hp.hpl.jena.rdf.model.Resource subjResource = null; com.hp.hpl.jena.graph.Node subject = getJenaNode(nuxStatement.getSubject()); if (subject != null && subject.isURI()) { subjResource = graph.getResource(subject.getURI()); } Property predProp = null; com.hp.hpl.jena.graph.Node predicate = getJenaNode(nuxStatement.getPredicate()); if (predicate != null && predicate.isURI()) { predProp = graph.getProperty(predicate.getURI()); } com.hp.hpl.jena.graph.Node object = getJenaNode(nuxStatement.getObject()); RDFNode objRDF = null; if (object != null) { objRDF = graph.asRDFNode(object); } return new SimpleSelector(subjResource, predProp, objRDF); }