当前位置: 首页>>代码示例>>Java>>正文


Java Graph.getValueFactory方法代码示例

本文整理汇总了Java中org.openrdf.model.Graph.getValueFactory方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.getValueFactory方法的具体用法?Java Graph.getValueFactory怎么用?Java Graph.getValueFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.model.Graph的用法示例。


在下文中一共展示了Graph.getValueFactory方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serialize

import org.openrdf.model.Graph; //导入方法依赖的package包/类
public Iterable<Statement> serialize( final EntityDescriptor entityDescriptor )
{
    Graph graph = new GraphImpl();
    ValueFactory values = graph.getValueFactory();
    URI entityTypeUri = values.createURI( Classes.toURI( entityDescriptor.types().findFirst().orElse( null ) ) );

    graph.add( entityTypeUri, Rdfs.TYPE, Rdfs.CLASS );
    graph.add( entityTypeUri, Rdfs.TYPE, OWL.CLASS );

    graph.add( entityTypeUri,
               PolygeneEntityType.TYPE,
               values.createLiteral( entityDescriptor.types().findFirst().get().toString() )
    );
    graph.add( entityTypeUri, PolygeneEntityType.QUERYABLE, values.createLiteral( entityDescriptor.queryable() ) );

    serializeMixinTypes( entityDescriptor, graph, entityTypeUri );

    serializePropertyTypes( entityDescriptor, graph, entityTypeUri );
    serializeAssociationTypes( entityDescriptor, graph, entityTypeUri );
    serializeManyAssociationTypes( entityDescriptor, graph, entityTypeUri );

    return graph;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:24,代码来源:EntityTypeSerializer.java

示例2: serializeManyAssociationTypes

import org.openrdf.model.Graph; //导入方法依赖的package包/类
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 );
    } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:19,代码来源:EntityTypeSerializer.java

示例3: serializeAssociationTypes

import org.openrdf.model.Graph; //导入方法依赖的package包/类
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 );
    } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:18,代码来源:EntityTypeSerializer.java

示例4: serializePropertyTypes

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializePropertyTypes( final EntityDescriptor entityDescriptor,
                                     final Graph graph,
                                     final URI entityTypeUri
)
{
    ValueFactory values = graph.getValueFactory();

    // Properties
    entityDescriptor.state().properties().forEach( persistentProperty -> {
        URI propertyURI = values.createURI( persistentProperty.qualifiedName().toURI() );
        graph.add( propertyURI, Rdfs.DOMAIN, entityTypeUri );
        graph.add( propertyURI, Rdfs.TYPE, Rdfs.PROPERTY );

        // TODO Support more types
        URI type = dataTypes.get( persistentProperty.valueType().primaryType().getName() );
        if( type != null )
        {
            graph.add( propertyURI, Rdfs.RANGE, type );
        }
    } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:22,代码来源:EntityTypeSerializer.java

示例5: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:17,代码来源:RyaAccumuloSailConfig.java

示例6: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
/**
 * export graph representation of config
    *
 * @Note - Graph is deprecating soon (in Sesame) to be replaced by Model
 */
public Resource export(Graph graph) {
	Resource implNode = super.export(graph);

	ValueFactory vf = graph.getValueFactory();
	if (getQueryEndpointUrl() != null) {
		graph.add(implNode, QUERY_ENDPOINT, vf.createURI(getQueryEndpointUrl()));
	}
	if (getUpdateEndpointUrl() != null) {
		graph.add(implNode, UPDATE_ENDPOINT, vf.createURI(getUpdateEndpointUrl()));
	}

	return implNode;
}
 
开发者ID:marklogic,项目名称:marklogic-sesame,代码行数:20,代码来源:MarkLogicRepositoryConfig.java

示例7: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@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;
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:23,代码来源:GeneralDBStoreConfig.java

示例8: serialize

import org.openrdf.model.Graph; //导入方法依赖的package包/类
public void serialize( final EntityState entityState,
                       final boolean includeNonQueryable,
                       final Graph graph
)
{
    ValueFactory values = graph.getValueFactory();
    EntityReference reference = entityState.entityReference();
    URI entityUri = createEntityURI( values, reference );

    graph.add( entityUri,
               Rdfs.TYPE,
               values.createURI(
                   Classes.toURI( entityState.entityDescriptor().types().findFirst().orElse( null ) ) ) );

    serializeProperties( entityState,
                         graph,
                         entityUri,
                         entityState.entityDescriptor(),
                         includeNonQueryable );

    serializeAssociations( entityState,
                           graph,
                           entityUri,
                           entityState.entityDescriptor().state().associations(),
                           includeNonQueryable );

    serializeManyAssociations( entityState,
                               graph,
                               entityUri,
                               entityState.entityDescriptor().state().manyAssociations(),
                               includeNonQueryable );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:33,代码来源:EntityStateSerializer.java

示例9: serializeProperty

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializeProperty( PropertyDescriptor persistentProperty, Object property,
                                Resource subject, Graph graph,
                                boolean includeNonQueryable )
{
    if( !( includeNonQueryable || persistentProperty.queryable() ) )
    {
        return; // Skip non-queryable
    }

    ValueType valueType = persistentProperty.valueType();

    final ValueFactory valueFactory = graph.getValueFactory();

    String propertyURI = persistentProperty.qualifiedName().toURI();
    URI predicate = valueFactory.createURI( propertyURI );
    String baseURI = propertyURI.substring( 0, propertyURI.indexOf( '#' ) ) + "/";

    if( valueType instanceof ValueCompositeType )
    {
        serializeValueComposite( subject, predicate, (ValueComposite) property, valueType,
                                 graph, baseURI, includeNonQueryable );
    }
    else
    {
        String stringProperty = serializer.serialize( Serializer.Options.NO_TYPE_INFO, property );
        final Literal object = valueFactory.createLiteral( stringProperty );
        graph.add( subject, predicate, object );
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:30,代码来源:EntityStateSerializer.java

示例10: serializeAssociations

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializeAssociations( final EntityState entityState,
                                    final Graph graph, URI entityUri,
                                    final Stream<? extends AssociationDescriptor> associations,
                                    final boolean includeNonQueryable
)
{
    ValueFactory values = graph.getValueFactory();

    // Associations
    associations.filter( type -> includeNonQueryable || type.queryable() ).forEach(
        associationType ->
        {
            EntityReference associatedId
                = entityState
                .associationValueOf(
                    associationType
                        .qualifiedName() );
            if( associatedId != null )
            {
                URI assocURI = values
                    .createURI(
                        associationType
                            .qualifiedName()
                            .toURI() );
                URI assocEntityURI
                    = values.createURI(
                    associatedId
                        .toURI() );
                graph.add( entityUri,
                           assocURI,
                           assocEntityURI );
            }
        } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:35,代码来源:EntityStateSerializer.java

示例11: serializeMixinTypes

import org.openrdf.model.Graph; //导入方法依赖的package包/类
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 ) ) );
    } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:12,代码来源:EntityTypeSerializer.java

示例12: serializeValueComposite

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializeValueComposite( Resource subject, URI predicate,
                                      ValueComposite value,
                                      ValueType valueType,
                                      Graph graph,
                                      String baseUri,
                                      boolean includeNonQueryable
)
{
    final ValueFactory valueFactory = graph.getValueFactory();
    BNode collection = valueFactory.createBNode();
    graph.add( subject, predicate, collection );

    ( (ValueCompositeType) valueType ).properties().forEach(
        persistentProperty ->
        {
            Object propertyValue
                = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF
                .apply( value )
                .state()
                .propertyFor( persistentProperty.accessor() )
                .get();

            if( propertyValue != null )
            {
                ValueType type = persistentProperty
                    .valueType();
                if( type instanceof ValueCompositeType )
                {
                    URI pred = valueFactory.createURI( baseUri,
                                                       persistentProperty
                                                           .qualifiedName()
                                                           .name() );
                    serializeValueComposite( collection, pred,
                                             (ValueComposite) propertyValue,
                                             type, graph,
                                             baseUri
                                             + persistentProperty
                                                 .qualifiedName()
                                                 .name() + "/",
                                             includeNonQueryable );
                }
                else
                {
                    serializeProperty( persistentProperty,
                                       propertyValue,
                                       collection, graph,
                                       includeNonQueryable );
                }
            }
        } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:52,代码来源:EntityStateSerializer.java

示例13: serializeManyAssociations

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void serializeManyAssociations( final EntityState entityState,
                                        final Graph graph,
                                        final URI entityUri,
                                        final Stream<? extends AssociationDescriptor> associations,
                                        final boolean includeNonQueryable
)
{
    ValueFactory values = graph.getValueFactory();

    // Many-Associations
    associations.filter( type -> includeNonQueryable || type.queryable() ).forEach(
        associationType ->
        {
            BNode collection = values
                .createBNode();
            graph.add( entityUri, values
                           .createURI(
                               associationType
                                   .qualifiedName()
                                   .toURI() ),
                       collection );
            graph.add( collection,
                       Rdfs.TYPE,
                       Rdfs.SEQ );

            ManyAssociationState
                associatedIds
                = entityState
                .manyAssociationValueOf(
                    associationType
                        .qualifiedName() );
            for( EntityReference associatedId : associatedIds )
            {
                URI assocEntityURI
                    = values.createURI(
                    associatedId
                        .toURI() );
                graph.add( collection,
                           Rdfs.LIST_ITEM,
                           assocEntityURI );
            }
        } );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:44,代码来源:EntityStateSerializer.java


注:本文中的org.openrdf.model.Graph.getValueFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。