org.apache.jena.rdf.model.Model.asRDFNode()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.apache.jena.rdf.model.Model.asRDFNode()方法的一些代码示例,展示了Model.asRDFNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.asRDFNode()方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:asRDFNode

Model.asRDFNode介绍

暂无

代码示例

代码示例来源:origin: TopQuadrant/shacl

public static RDFNode toRDFNode(Node node) {
  if(node != null) {
    return dummyModel.asRDFNode(node);
  }
  else {
    return null;
  }
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public static RDFNode toRDFNode(Node node) {
  if(node != null) {
    return dummyModel.asRDFNode(node);
  }
  else {
    return null;
  }
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public static boolean isInstanceOf(Node instance, Node type, Graph graph) {
    // TODO: Use Node API only (maybe worth it)
    Model model = ModelFactory.createModelForGraph(graph);
    return JenaUtil.hasIndirectType((Resource)model.asRDFNode(instance), (Resource)model.asRDFNode(type));
  }
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public boolean isIgnored(Node shapeNode) {
  if(shapeFilter == null) {
    return false;
  }
  SHShape shape = SHFactory.asShape(shapesModel.asRDFNode(shapeNode));
  return !shapeFilter.test(shape);
}

代码示例来源:origin: TopQuadrant/shacl

public boolean isIgnored(Node shapeNode) {
  if(shapeFilter == null) {
    return false;
  }
  else {
    SHShape shape = SHFactory.asShape(shapesModel.asRDFNode(shapeNode));
    return !shapeFilter.test(shape);
  }
}

代码示例来源:origin: TopQuadrant/shacl

public static boolean isInstanceOf(Node instance, Node type, Graph graph) {
    // TODO: Use Node API only (maybe worth it)
    Model model = ModelFactory.createModelForGraph(graph);
    return JenaUtil.hasIndirectType((Resource)model.asRDFNode(instance), (Resource)model.asRDFNode(type));
  }
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public Shape getShape(Node node) {
  Shape shape = shapesMap.get(node);
  if(shape == null) {
    shape = new Shape(this, SHFactory.asShape(shapesModel.asRDFNode(node)));
    shapesMap.put(node, shape);
  }
  return shape;
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public static void addValueNodes(RDFNode focusNode, Path path, Collection<RDFNode> results) {
  Set<Node> seen = new HashSet<>();
  Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), path, Context.emptyContext);
  while(it.hasNext()) {
    Node node = it.next();
    if(!seen.contains(node)) {
      seen.add(node);
      results.add(focusNode.getModel().asRDFNode(node));
    }
  }
}

代码示例来源:origin: TopQuadrant/shacl

public static void addValueNodes(RDFNode focusNode, Path path, Collection<RDFNode> results) {
  Set<Node> seen = new HashSet<>();
  Iterator<Node> it = PathEval.eval(focusNode.getModel().getGraph(), focusNode.asNode(), path, Context.emptyContext);
  while(it.hasNext()) {
    Node node = it.next();
    if(!seen.contains(node)) {
      seen.add(node);
      results.add(focusNode.getModel().asRDFNode(node));
    }
  }
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

@Override
  protected NodeValue exec(Node nodeNode, Node shapeNode, FunctionEnv env) {
    Model model = ModelFactory.createModelForGraph(env.getActiveGraph());
    SHShape shape = SHFactory.asShape(model.asRDFNode(shapeNode));
    return NodeValue.makeBoolean(shape.hasTargetNode(model.asRDFNode(nodeNode)));
  }
}

代码示例来源:origin: apache/jena

public static RDFNode rdfNode( final Model m, final String s )
{
  return m.asRDFNode(NodeCreateUtils.create(m, s));
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public boolean add(T obj) {
  Node node = nodeMapper.toNode(obj);
  RDFNode rdfNode = subject.getModel().asRDFNode(node);
  boolean result = ResourceUtils.addProperty(subject, property, rdfNode);
  return result;
}

代码示例来源:origin: apache/jena

@Override
public SecuredRDFNode asRDFNode(final Node n) {
  return SecuredRDFNodeImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().asRDFNode(n));
}

代码示例来源:origin: org.apache.jena/jena-core

public static RDFNode rdfNode( final Model m, final String s )
{
  return m.asRDFNode(NodeCreateUtils.create(m, s));
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

public static Model toModel(RDFResourceTree tree) {
  Model model = ModelFactory.createDefaultModel();
  buildModel(model, tree, model.asRDFNode(NodeFactory.createBlankNode()).asResource());
  return model;
}

代码示例来源:origin: apache/jena

private void testPresentAsRDFNode( Node n, Class<? extends RDFNode> nodeClass )
  {
  RDFNode r = model.asRDFNode( n );
  assertSame( n, r.asNode() );
  assertInstanceOf( nodeClass, r );
  }

代码示例来源:origin: apache/jena

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);
}

代码示例来源:origin: org.apache.jena/jena-core

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);
}

代码示例来源:origin: org.apache.jena/jena-core

private void testPresentAsRDFNode( Node n, Class<? extends RDFNode> nodeClass )
  {
  RDFNode r = model.asRDFNode( n );
  assertSame( n, r.asNode() );
  assertInstanceOf( nodeClass, r );
  }

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

public static <T> boolean setProperty(Resource s, Property p, NodeMapper<T> nodeMapper, T value) {
  
  RDFNode o = value == null ? null : s.getModel().asRDFNode(nodeMapper.toNode(value));
  boolean result = replaceProperties(s.getModel(),
      listProperties(s, p, nodeMapper),
      o == null ? null : s.getModel().createStatement(s, p, o));
  return result;
}

相关文章

Model类方法