org.openrdf.model.Graph.getValueFactory()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(88)

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

Graph.getValueFactory介绍

[英]Gets the value factory for this graph.
[中]获取此图形的值工厂。

代码示例

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-jsonld

/**
 * @param storageGraph
 *            the storageGraph to set
 */
public void setStorageGraph(Graph storageGraph) {
  this.storageGraph = storageGraph;
  if (storageGraph != null) {
    vf = storageGraph.getValueFactory();
  }
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

public SerializerContext( Graph graph )
{
  this.valueFactory = graph.getValueFactory();
  this.graph = graph;
}

代码示例来源:origin: apache/attic-polygene-java

public SerializerContext( Graph graph )
{
  this.valueFactory = graph.getValueFactory();
  this.graph = graph;
}

代码示例来源:origin: blazegraph/database

/**
 * Describe the service end point(s).
 * 
 * @see #endpoint
 */
protected void describeServiceEndpoints() {
  for (String uri : serviceURI) {
    g.add(aService, SD.endpoint, g.getValueFactory().createURI(uri));
  }
}

代码示例来源:origin: com.blazegraph/bigdata-core

/**
 * Describe the service end point(s).
 * 
 * @see #endpoint
 */
protected void describeServiceEndpoints() {
  for (String uri : serviceURI) {
    g.add(aService, SD.endpoint, g.getValueFactory().createURI(uri));
  }
}

代码示例来源:origin: blazegraph/database

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: blazegraph/database

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public Resource export(Graph graph)
{
  Resource implNode = super.export(graph);
  if (propertiesFile != null) {
    graph.add(implNode, BigdataConfigSchema.PROPERTIES, 
        graph.getValueFactory().createLiteral(propertiesFile));
  }
  return implNode;
}

代码示例来源:origin: apache/attic-polygene-java

private void serializeMixinTypes( final EntityDescriptor entityDescriptor,
                 final Graph graph,
                 final URI entityTypeUri
)
{
  ValueFactory values = graph.getValueFactory();
  entityDescriptor.mixinTypes().forEach( mixinType -> {
    graph.add( entityTypeUri, Rdfs.SUB_CLASS_OF, values.createURI( Classes.toURI( mixinType ) ) );
  } );
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

private void serializeMixinTypes( final EntityDescriptor entityDescriptor,
                 final Graph graph,
                 final URI entityTypeUri )
{
  ValueFactory values = graph.getValueFactory();
  // Mixin types
  for( Class<?> mixinType : entityDescriptor.mixinTypes() )
  {
    graph.add( entityTypeUri, Rdfs.SUB_CLASS_OF, values.createURI( Classes.toURI( mixinType ) ) );
  }
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-sparql

@Override
public Resource export(Graph graph) {
  Resource implNode = super.export(graph);
  ValueFactory vf = graph.getValueFactory();
  if (url != null) {
    graph.add(implNode, ENDPOINT, vf.createURI(url));
  }
  for (String space : subjects) {
    graph.add(implNode, SUBJECT_SPACE, vf.createURI(space));
  }
  return implNode;
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

@Override
public Resource export(Graph graph) {
  Resource subj = super.export(graph);
  ValueFactory vf = graph.getValueFactory();
  graph.add(subj, SNAPSHOT, vf.createLiteral(snapshot));
  graph.add(subj, SERIALIZABLE, vf.createLiteral(serializable));
  return subj;
}

代码示例来源:origin: apache/attic-polygene-java

private void serializeAssociationTypes( final EntityDescriptor entityDescriptor,
                    final Graph graph,
                    final URI entityTypeUri
)
{
  ValueFactory values = graph.getValueFactory();
  // Associations
  entityDescriptor.state().associations().forEach( associationType -> {
    URI associationURI = values.createURI( associationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.DOMAIN, entityTypeUri );
    graph.add( associationURI, Rdfs.TYPE, Rdfs.PROPERTY );
    URI associatedURI = values.createURI( Classes.toURI( Classes.RAW_CLASS.apply( associationType.type() ) ) );
    graph.add( associationURI, Rdfs.RANGE, associatedURI );
    graph.add( associationURI, Rdfs.RANGE, XMLSchema.ANYURI );
  } );
}

代码示例来源:origin: apache/attic-polygene-java

private void serializeManyAssociationTypes( final EntityDescriptor entityDescriptor,
                      final Graph graph,
                      final URI entityTypeUri
)
{
  ValueFactory values = graph.getValueFactory();
  // ManyAssociations
  entityDescriptor.state().manyAssociations().forEach( manyAssociationType -> {
    URI associationURI = values.createURI( manyAssociationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.DOMAIN, entityTypeUri );
    graph.add( associationURI, Rdfs.TYPE, Rdfs.SEQ );
    URI associatedURI = values.createURI( manyAssociationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.RANGE, associatedURI );
    graph.add( associationURI, Rdfs.RANGE, XMLSchema.ANYURI );
  } );
}

代码示例来源:origin: org.apache.rya/rya.indexing

@Override
public Resource export(final Graph graph) {
  final Resource implNode = super.export(graph);
  @SuppressWarnings("deprecation")
  final
  ValueFactory v = graph.getValueFactory();
  graph.add(implNode, USER, v.createLiteral(user));
  graph.add(implNode, PASSWORD, v.createLiteral(password));
  graph.add(implNode, INSTANCE, v.createLiteral(instance));
  graph.add(implNode, ZOOKEEPERS, v.createLiteral(zookeepers));
  graph.add(implNode, IS_MOCK, v.createLiteral(isMock));
  return implNode;
}

代码示例来源:origin: org.openrdf.sesame/sesame-sail-rdbms

@Override
public Resource export(Graph graph) {
  Resource implNode = super.export(graph);
  ValueFactory vf = graph.getValueFactory();
  if (jdbcDriver != null) {
    graph.add(implNode, JDBC_DRIVER, vf.createLiteral(jdbcDriver));
  }
  if (url != null) {
    graph.add(implNode, URL, vf.createLiteral(url));
  }
  if (user != null) {
    graph.add(implNode, USER, vf.createLiteral(user));
  }
  if (password != null) {
    graph.add(implNode, PASSWORD, vf.createLiteral(password));
  }
  graph.add(implNode, MAX_TRIPLE_TABLES, vf.createLiteral(maxTripleTables));
  return implNode;
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

public Iterable<Statement> serialize( final EntityDescriptor entityDescriptor )
{
  Graph graph = new GraphImpl();
  ValueFactory values = graph.getValueFactory();
  URI entityTypeUri = values.createURI( Classes.toURI( first( entityDescriptor.types() ) ) );
  graph.add( entityTypeUri, Rdfs.TYPE, Rdfs.CLASS );
  graph.add( entityTypeUri, Rdfs.TYPE, OWL.CLASS );
  graph.add( entityTypeUri, Qi4jEntityType.TYPE, values.createLiteral( first( entityDescriptor.types() ).toString() ) );
  graph.add( entityTypeUri, Qi4jEntityType.QUERYABLE, values.createLiteral( entityDescriptor.queryable() ) );
  serializeMixinTypes( entityDescriptor, graph, entityTypeUri );
  serializePropertyTypes( entityDescriptor, graph, entityTypeUri );
  serializeAssociationTypes( entityDescriptor, graph, entityTypeUri );
  serializeManyAssociationTypes( entityDescriptor, graph, entityTypeUri );
  return graph;
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

private void serializeManyAssociationTypes( final EntityDescriptor entityDescriptor,
                      final Graph graph,
                      final URI entityTypeUri )
{
  ValueFactory values = graph.getValueFactory();
  // ManyAssociations
  for( AssociationDescriptor manyAssociationType : entityDescriptor.state().manyAssociations() )
  {
    URI associationURI = values.createURI( manyAssociationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.DOMAIN, entityTypeUri );
    graph.add( associationURI, Rdfs.TYPE, Rdfs.SEQ );
    URI associatedURI = values.createURI( manyAssociationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.RANGE, associatedURI );
    graph.add( associationURI, Rdfs.RANGE, XMLSchema.ANYURI );
  }
}

代码示例来源:origin: org.qi4j.library/org.qi4j.library.rdf

private void serializeAssociationTypes( final EntityDescriptor entityDescriptor,
                    final Graph graph,
                    final URI entityTypeUri )
{
  ValueFactory values = graph.getValueFactory();
  // Associations
  for( AssociationDescriptor associationType : entityDescriptor.state().associations() )
  {
    URI associationURI = values.createURI( associationType.qualifiedName().toURI() );
    graph.add( associationURI, Rdfs.DOMAIN, entityTypeUri );
    graph.add( associationURI, Rdfs.TYPE, Rdfs.PROPERTY );
    URI associatedURI = values.createURI( Classes.toURI( Classes.RAW_CLASS.map( associationType.type() ) ) );
    graph.add( associationURI, Rdfs.RANGE, associatedURI );
    graph.add( associationURI, Rdfs.RANGE, XMLSchema.ANYURI );
  }
}

相关文章