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


Java Graph.add方法代码示例

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


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

示例3: 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

示例4: 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

示例5: addEPCsToGraph

import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
 * @param ns
 * @param mySubject
 * @param myGraph
 * @param epcArray
 */
public Graph addEPCsToGraph(Namespaces ns, Graph myGraph, URI mySubject,
        ArrayList<String> epcArray) {

    if (epcArray.size() > 0) {
        ValueFactory myFactory = ValueFactoryImpl.getInstance();

        BNode bnodeEPC = myFactory.createBNode();
        // link the EPCS to the event
        myGraph.add(mySubject, myFactory.createURI(
                ns.getIRIForPrefix("eem"), "associatedWithEPCList"),
                bnodeEPC);
        myGraph.add(bnodeEPC, RDF.TYPE,
                myFactory.createURI(ns.getIRIForPrefix("eem"), "SetOfEPCs"));
        for (String e : epcArray) {
            myGraph.add(bnodeEPC,
                    myFactory.createURI("http://purl.org/co#element"),
                    myFactory.createURI(e.trim()));
            // System.out.println(e);
        }
    }
    return myGraph;
}
 
开发者ID:nimonika,项目名称:LinkedEPCIS,代码行数:29,代码来源:EPCISCommon.java

示例6: setReaderForEvent

import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
 * @param myGraph
 * @param mySubject2
 * @param reader
 * @return
 */
public Graph setReaderForEvent(Namespaces ns, String prefix, Graph myGraph,
        URI mySubject, Reader reader) {

    URI readerURI = ValueFactoryImpl.getInstance().createURI(
            ns.getIRIForPrefix(prefix), reader.getPhysicalReaderID());

    myGraph.add(readerURI, RDF.TYPE, ValueFactoryImpl.getInstance()
            .createURI(ns.getIRIForPrefix("eem"), "Reader"));
    myGraph.add(
            readerURI,
            ValueFactoryImpl.getInstance().createURI(
                    ns.getIRIForPrefix("eem"), "logicalID"),
            ValueFactoryImpl.getInstance().createLiteral(
                    reader.getPhysicalReaderID()));

    myGraph.add(
            mySubject,
            ValueFactoryImpl.getInstance().createURI(
                    ns.getIRIForPrefix("eem"), "recordedByReader"),
            readerURI);

    return myGraph;
}
 
开发者ID:nimonika,项目名称:LinkedEPCIS,代码行数:30,代码来源:EPCISCommon.java

示例7: shouldProperlyConvertGraphToGraphVizModel

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Test
public void shouldProperlyConvertGraphToGraphVizModel() throws Exception {
    ValueFactory v = new ValueFactoryImpl();

    Graph graph = new TreeModel();
    graph.add(v.createStatement(
            v.createURI("http://test.urn"),
            v.createURI("http://predicate"),
            v.createLiteral("Test label")
    ));

    graph.add(v.createStatement(
            v.createURI("http://test.urn1"),
            v.createURI("http://predicate1"),
            v.createLiteral("Test label1")
    ));

    String stringForm = new GraphConverter().getStringForm(graph);

    Approvals.verify(stringForm, Paths.get("src/test/resources/approvals/shouldProperlyConvertGraphToGraphVizModel.dot"));
}
 
开发者ID:nikolavp,项目名称:approval,代码行数:22,代码来源:GraphConverterTest.java

示例8: shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Test
public void shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication() throws Exception {
    ValueFactory v = new ValueFactoryImpl();

    Graph graph = new TreeModel();
    graph.add(v.createStatement(
            v.createURI("http://test.urn"),
            v.createURI("http://predicate"),
            v.createLiteral("Test label")
    ));

    graph.add(v.createStatement(
            v.createURI("http://test.urn1"),
            v.createURI("http://predicate1"),
            v.createLiteral("Test label1")
    ));

    Approval<Graph> approval = Approval.of(Graph.class)
            .withConveter(new GraphConverter())
            .withReporter(GraphReporter.getInstance())
            .build();
    approval.verify(graph, Paths.get("src/test/resources/approvals/shouldProperlyConvertTheDotFormatAndThenReportItInConfigredApplication.dot"));
}
 
开发者ID:nikolavp,项目名称:approval,代码行数:24,代码来源:GraphReporterIT.java

示例9: 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

示例10: 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

示例11: exportAssocation

import org.openrdf.model.Graph; //导入方法依赖的package包/类
private void exportAssocation(Resource subj, Map<Class<?>, List<URI>> assocation,
		URI relation, Graph model) {
	ValueFactory vf = ValueFactoryImpl.getInstance();
	for (Map.Entry<Class<?>, List<URI>> e : assocation.entrySet()) {
		URI name = vf.createURI(JAVA_NS, e.getKey().getName());
		model.add(subj, relation, name);
		if (e.getValue() != null) {
			for (URI value : e.getValue()) {
				model.add(name, KNOWN_AS, value);
			}
		}
	}
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:14,代码来源:ObjectRepositoryConfig.java

示例12: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
	 * Adds all Repository configuration settings to a configuration model.
	 * 
	 * @param model the configuration model to be filled.
	 * @return the resource representing this repository configuration.
	 */
	@Override
//	public Resource export(Model model) { // Sesame 3
	public Resource export(Graph model) { // Sesame 2
		Resource implNode = super.export(model);

		model.add(implNode, VOID_URI, this.voidUri);
		
		if (this.endpoint != null)
			model.add(implNode, ENDPOINT, this.endpoint);
		
		return implNode;
	}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:19,代码来源:VoidRepositoryConfig.java

示例13: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(Graph model) {
	ValueFactoryImpl vf = ValueFactoryImpl.getInstance();

	BNode implNode = vf.createBNode();

	if (type != null) {
		model.add(implNode, this.typePredicate, vf.createLiteral(type));
	}

	return implNode;
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:13,代码来源:AbstractSailConfig.java

示例14: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
/**
 * Adds all Sail configuration settings to a configuration model.
 * 
 * @param model the configuration model to be filled.
 * @return the resource representing this Sail configuration.
 */
@Override
public Resource export(Graph model) {
	
	Resource self = super.export(model);
	
	for (RepositoryImplConfig member : this.memberConfig) {
		model.add(self, MEMBER, member.export(model));
	}
	
	model.add(self, SRC_SELECTION, this.selectorConfig.export(model));
	model.add(self, QUERY_OPT, this.optimizerConfig.export(model));
	
	return self;
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:21,代码来源:FederationSailConfig.java

示例15: export

import org.openrdf.model.Graph; //导入方法依赖的package包/类
@Override
public Resource export(Graph model) {
	ValueFactory vf = ValueFactoryImpl.getInstance();
	
	Resource self = super.export(model);
	model.add(self, USE_TYPE_STATS, vf.createLiteral(this.useTypeStats));
	
	return self;
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:10,代码来源:SourceSelectorConfig.java


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