org.apache.clerezza.commons.rdf.Graph.add()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(138)

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

Graph.add介绍

暂无

代码示例

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.servicesapi

public static BlankNodeOrIRI createEngineExecution(Graph graph, BlankNodeOrIRI chainExecution,
                 BlankNodeOrIRI executionNode){
  
  BlankNodeOrIRI node = new BlankNode();
  graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION));
  graph.add(new TripleImpl(node, RDF_TYPE, ENGINE_EXECUTION));
  graph.add(new TripleImpl(node, EXECUTION_PART, chainExecution));
  graph.add(new TripleImpl(node, EXECUTION_NODE, executionNode));
  graph.add(new TripleImpl(node, STATUS, STATUS_SCHEDULED));
  return node;
}
/**

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

public static BlankNodeOrIRI createEngineExecution(Graph graph, BlankNodeOrIRI chainExecution,
                 BlankNodeOrIRI executionNode){
  
  BlankNodeOrIRI node = new BlankNode();
  graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION));
  graph.add(new TripleImpl(node, RDF_TYPE, ENGINE_EXECUTION));
  graph.add(new TripleImpl(node, EXECUTION_PART, chainExecution));
  graph.add(new TripleImpl(node, EXECUTION_NODE, executionNode));
  graph.add(new TripleImpl(node, STATUS, STATUS_SCHEDULED));
  return node;
}
/**

代码示例来源:origin: org.apache.clerezza/rdf.utils

/**
 * Adds a property to the node with the specified predicate and object
 *
 * @param predicate
 * @param object
 */
public void addProperty(IRI predicate, RDFTerm object) {
  if (resource instanceof BlankNodeOrIRI) {
    graph.add(new TripleImpl((BlankNodeOrIRI) resource, predicate, object));
  } else {
    throw new RuntimeException("Literals cannot be the subject of a statement");
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.servicesapi

public static BlankNodeOrIRI createChainExecutionNode(Graph graph, BlankNodeOrIRI executionPlan, 
                  IRI ciUri, boolean defaultChain){
  BlankNodeOrIRI node = new BlankNode();
  graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION));
  graph.add(new TripleImpl(node, RDF_TYPE, CHAIN_EXECUTION));
  graph.add(new TripleImpl(node, ENHANCES, ciUri));
  graph.add(new TripleImpl(ciUri, ENHANCED_BY, node));
  graph.add(new TripleImpl(node, STATUS, STATUS_SCHEDULED));
  graph.add(new TripleImpl(node, EXECUTION_PLAN, executionPlan));
  graph.add(new TripleImpl(node, IS_DEFAULT_CHAIN, 
    lf.createTypedLiteral(defaultChain)));
  return node;
}

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

/**
 * Adds a property to the node with the specified predicate and object
 *
 * @param predicate
 * @param object
 */
public void addProperty(IRI predicate, RDFTerm object) {
  if (resource instanceof BlankNodeOrIRI) {
    graph.add(new TripleImpl((BlankNodeOrIRI) resource, predicate, object));
  } else {
    throw new RuntimeException("Literals cannot be the subject of a statement");
  }
}

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

public static BlankNodeOrIRI createChainExecutionNode(Graph graph, BlankNodeOrIRI executionPlan, 
                  IRI ciUri, boolean defaultChain){
  BlankNodeOrIRI node = new BlankNode();
  graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION));
  graph.add(new TripleImpl(node, RDF_TYPE, CHAIN_EXECUTION));
  graph.add(new TripleImpl(node, ENHANCES, ciUri));
  graph.add(new TripleImpl(ciUri, ENHANCED_BY, node));
  graph.add(new TripleImpl(node, STATUS, STATUS_SCHEDULED));
  graph.add(new TripleImpl(node, EXECUTION_PLAN, executionPlan));
  graph.add(new TripleImpl(node, IS_DEFAULT_CHAIN, 
    lf.createTypedLiteral(defaultChain)));
  return node;
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@Override
public void scopeAppended(Session session, String scopeId) {
  final IRI sessionur = getIRIforSession(session), scopeur = getIRIforScope(scopeId);
  if (sessionur == null || scopeur == null) throw new IllegalArgumentException(
      "IRIs for scope and session cannot be null.");
  if (meta instanceof Graph) synchronized (meta) {
    meta.add(new TripleImpl(sessionur, HAS_APPENDED_URIREF, scopeur));
    meta.add(new TripleImpl(scopeur, APPENDED_TO_URIREF, sessionur));
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

private void updateSessionRegistration(Session session) {
  final IRI sesur = getIRIforSession(session);
  // If this method was called after a session rebuild, the following will have little to no effect.
  synchronized (meta) {
    // The only essential triple to add is typing
    meta.add(new TripleImpl(sesur, RDF.type, SESSION_URIREF));
  }
  log.debug("Ontology collector information triples added for session \"{}\".", sesur);
}

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

public static void makeConnected(Graph model, BlankNodeOrIRI root, IRI property) {
  Set<BlankNodeOrIRI> roots = findRoots(model);
  LOG.debug("Roots: {}",roots.size());
  boolean found = roots.remove(root);
  //connect all hanging roots to root by property
  for (BlankNodeOrIRI n: roots) {
    model.add(new TripleImpl(root,property,n));            
  }
}

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

@Override
public boolean apply(Graph graph, BlankNodeOrIRI subject, Metadata metadata) {
  for(RDFTerm value : values){
    graph.add(new TripleImpl(subject, ontProperty, value));
    mappingLogger.log(subject, ontProperty, null, value);
  }
  return true;
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.engines.htmlextractor

public static void makeConnected(Graph model, BlankNodeOrIRI root, IRI property) {
  Set<BlankNodeOrIRI> roots = findRoots(model);
  LOG.debug("Roots: {}",roots.size());
  boolean found = roots.remove(root);
  //connect all hanging roots to root by property
  for (BlankNodeOrIRI n: roots) {
    model.add(new TripleImpl(root,property,n));            
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

public void updateAddAlias(OWLOntologyID subject, OWLOntologyID object) {
  // For now add both owl:sameAs statements
  IRI suben = buildResource(subject), oben = buildResource(object);
  synchronized (graph) {
    graph.add(new TripleImpl(suben, OWL.sameAs, oben));
    graph.add(new TripleImpl(oben, OWL.sameAs, suben));
  }
  // XXX add the Entry typing later on, but if so give up on using owl:sameAs.
}

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

@Override
public void scopeAppended(Session session, String scopeId) {
  final IRI sessionur = getIRIforSession(session), scopeur = getIRIforScope(scopeId);
  if (sessionur == null || scopeur == null) throw new IllegalArgumentException(
      "IRIs for scope and session cannot be null.");
  if (meta instanceof Graph) synchronized (meta) {
    meta.add(new TripleImpl(sessionur, HAS_APPENDED_URIREF, scopeur));
    meta.add(new TripleImpl(scopeur, APPENDED_TO_URIREF, sessionur));
  }
}

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

private void updateSessionRegistration(Session session) {
  final IRI sesur = getIRIforSession(session);
  // If this method was called after a session rebuild, the following will have little to no effect.
  synchronized (meta) {
    // The only essential triple to add is typing
    meta.add(new TripleImpl(sesur, RDF.type, SESSION_URIREF));
  }
  log.debug("Ontology collector information triples added for session \"{}\".", sesur);
}

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

public void updateAddAlias(OWLOntologyID subject, OWLOntologyID object) {
  // For now add both owl:sameAs statements
  IRI suben = buildResource(subject), oben = buildResource(object);
  synchronized (graph) {
    graph.add(new TripleImpl(suben, OWL.sameAs, oben));
    graph.add(new TripleImpl(oben, OWL.sameAs, suben));
  }
  // XXX add the Entry typing later on, but if so give up on using owl:sameAs.
}

代码示例来源:origin: org.apache.clerezza/platform.config

/**
 * Adds a base URI to the Clerezza platform instance.
 *
 * @param baseUri The base URI which will be added to the platform instance
 */
public void addBaseUri(IRI baseUri) {
  systemGraph.add(new TripleImpl(getPlatformInstanceRDFTerm(), PLATFORM.baseUri, baseUri));
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

private void attachScopeImportsClerezza(Graph target, org.semanticweb.owlapi.model.IRI prefix) {
  IRI iri = new IRI(prefix + _id);
  String scopePrefix = prefix.toString();
  scopePrefix = scopePrefix.substring(0, scopePrefix.lastIndexOf("/" + shortName + "/")) + "/ontology/";
  for (String scopeID : attachedScopes) {
    IRI physIRI = new IRI(scopePrefix + scopeID);
    target.add(new TripleImpl(iri, OWL.imports, physIRI));
  }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@Override
public void setDependency(OWLOntologyID dependent, OWLOntologyID dependency) {
  if (dependent == null) throw new IllegalArgumentException("dependent cannot be null");
  if (dependency == null) throw new IllegalArgumentException("dependency cannot be null");
  log.debug("Setting dependency.");
  log.debug(" ... dependent : {}", dependent);
  log.debug(" ... dependency : {}", dependency);
  IRI dep = buildResource(dependent), depy = buildResource(dependency);
  // TODO check for the actual resource!
  synchronized (meta) {
    meta.add(new TripleImpl(dep, DEPENDS_ON_URIREF, depy));
  }
  log.debug("DONE setting dependency.");
}

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

private boolean addValue(IRI property, Object value){
  RDFTerm rdfValue;
  try {
    rdfValue = getRdfResource(value);
    return factory.getGraph().add(new TripleImpl(rdfNode, property, rdfValue));
  } catch (NoConvertorException e){
    throw new IllegalArgumentException("Unable to transform "+value.getClass()
        +" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
  }
}
private boolean removeValue(IRI property, Object value){

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.enhancer.rdfentities

private boolean addValue(IRI property, Object value){
  RDFTerm rdfValue;
  try {
    rdfValue = getRdfResource(value);
    return factory.getGraph().add(new TripleImpl(rdfNode, property, rdfValue));
  } catch (NoConvertorException e){
    throw new IllegalArgumentException("Unable to transform "+value.getClass()
        +" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
  }
}
private boolean removeValue(IRI property, Object value){

相关文章