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


Java GraphImpl类代码示例

本文整理汇总了Java中org.openrdf.model.impl.GraphImpl的典型用法代码示例。如果您正苦于以下问题:Java GraphImpl类的具体用法?Java GraphImpl怎么用?Java GraphImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parseConfig

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
protected Graph parseConfig(File file) throws SailConfigException, IOException {

        RDFFormat format = Rio.getParserFormatForFileName(file.getAbsolutePath());
        if (format==null)
            throw new SailConfigException("Unsupported file format: " + file.getAbsolutePath());
        RDFParser parser = Rio.createParser(format);
        Graph model = new GraphImpl();
        parser.setRDFHandler(new StatementCollector(model));
        InputStream stream = new FileInputStream(file);

        try {
            parser.parse(stream, file.getAbsolutePath());
        } catch (Exception e) {
            throw new SailConfigException("Error parsing file!");
        }

        stream.close();
        return model;
    }
 
开发者ID:dice-group,项目名称:CostFed,代码行数:20,代码来源:QueryEvaluation.java

示例2: serialize

import org.openrdf.model.impl.GraphImpl; //导入依赖的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

示例3: flushUpdates

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
@Override
public void flushUpdates()
	throws SailException
{
	super.flushUpdates();

	if (this.statementsRemoved) {
		this.logger.debug("statements removed, starting inferencing from scratch");
		clearInferred();
		addAxiomStatements();

		this.newStatements = new GraphImpl();
		Iterations.addAll(getWrappedConnection().getStatements(null, null, null, true), this.newStatements);

		this.statementsRemoved = false;
	}

	doInferencing();
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:20,代码来源:ForwardChainingRDFSInferencerConnection.java

示例4: parseFile

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
public Model parseFile(InputStream configurationFile, RDFFormat format,
        String defaultNamespace) throws Exception {
    final Graph graph = new GraphImpl();
    RDFParser parser = Rio.createParser(format);
    org.openrdf.model.Model myGraph = new org.openrdf.model.impl.LinkedHashModel();

    /*
     * RDFHandler handler = new RDFHandler() { public void endRDF() throws
     * RDFHandlerException { }
     * 
     * public void handleComment(String arg0) throws RDFHandlerException { }
     * 
     * public void handleNamespace(String arg0, String arg1) throws
     * RDFHandlerException { }
     * 
     * public void handleStatement(Statement statement) throws
     * RDFHandlerException { graph.add(statement); }
     * 
     * public void startRDF() throws RDFHandlerException { } };
     */
    parser.setRDFHandler(new StatementCollector(myGraph));

    parser.parse(configurationFile, defaultNamespace);
    return myGraph;
}
 
开发者ID:nimonika,项目名称:LinkedEPCIS,代码行数:26,代码来源:CommonFunctions.java

示例5: serialize

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
public Iterable<Statement> serialize( final EntityState entityState,
                                      final boolean includeNonQueryable
)
{
    Graph graph = new GraphImpl();
    serialize( entityState, includeNonQueryable, graph );
    return graph;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:9,代码来源:EntityStateSerializer.java

示例6: serialize

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
public Graph serialize( Application app )
{
    Graph graph = new GraphImpl();
    SerializerContext context = new SerializerContext( graph );
    ApplicationVisitor applicationVisitor = new ApplicationVisitor( context );
    app.descriptor().accept( applicationVisitor );
    return graph;
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:9,代码来源:ApplicationSerializer.java

示例7: indexEntityState

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
private void indexEntityState( final EntityState entityState,
                               final RepositoryConnection connection
)
    throws RepositoryException
{
    if( entityState.entityDescriptor().queryable() )
    {
        EntityReference reference = entityState.entityReference();
        final URI entityURI = stateSerializer.createEntityURI( getValueFactory(), reference);
        Graph graph = new GraphImpl();
        stateSerializer.serialize( entityState, false, graph );
        connection.add( graph, entityURI );
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:15,代码来源:RdfIndexerService.java

示例8: asSesameGraph

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
/**
 * Convert the Jena Model to a Sesame Graph
 * @param theModel the model to convert
 * @return the set of statements in the Jena model saved in a sesame Graph
 */
public static Graph asSesameGraph(Model theModel) {
    Graph aGraph = new GraphImpl();

    StmtIterator sIter = theModel.listStatements();
    while (sIter.hasNext()) {
        aGraph.add(asSesameStatement(sIter.nextStatement()));
    }

    sIter.close();

    return aGraph;
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:18,代码来源:JenaSesameUtils.java

示例9: statementAdded

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
public void statementAdded(Statement st) {
	if (this.statementsRemoved) {
		// No need to record, starting from scratch anyway
		return;
	}

	if (this.newStatements == null) {
		this.newStatements = new GraphImpl();
	}
	this.newStatements.add(st);
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:12,代码来源:ForwardChainingRDFSInferencerConnection.java

示例10: prepareIteration

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
protected void prepareIteration() {
	for (int i = 0; i < RDFSPlusInversesRules.RULECOUNT; i++) {
		this.checkRule[i] = this.checkRuleNextIter[i];

		// reset for next iteration:
		this.checkRuleNextIter[i] = false;
	}

	this.newThisIteration = this.newStatements;
	this.newStatements = new GraphImpl();
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:12,代码来源:ForwardChainingRDFSInferencerConnection.java

示例11: parseRdf

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
private Graph parseRdf(String config, ValueFactory vf, RDFFormat lang) {
  Graph graph = new GraphImpl(vf);
  RDFParser rdfParser = Rio.createParser(lang, vf);
  rdfParser.setRDFHandler(new StatementCollector(graph));
  try {
    rdfParser.parse(new StringReader(config), RepositoryConfigSchema.NAMESPACE);
  } catch (Exception e) {
    throw new SesameManagerException("Could not parse rdf: " + e);
  }
  return graph;
}
 
开发者ID:Network-of-BioThings,项目名称:GettinCRAFTy,代码行数:12,代码来源:SesameManager.java

示例12: asSesameGraph

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
/**
 * Convert the Jena Model to a Sesame Graph
 * @param theModel the model to convert
 * @return the set of statements in the Jena model saved in a sesame Graph
 */
public static Graph asSesameGraph(Model theModel) {
	Graph aGraph = new GraphImpl();

	StmtIterator sIter = theModel.listStatements();
	while (sIter.hasNext()) {
		aGraph.add(asSesameStatement(sIter.nextStatement()));
	}

	sIter.close();

	return aGraph;
}
 
开发者ID:SEMOSS,项目名称:semoss,代码行数:18,代码来源:JenaSesameUtils.java

示例13: setup

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
private void setup() {

  	// by default, an in-memory RdfRepository is used as storage backend
      graph = new GraphImpl();
      namespaces = new HashMap<String, String>();
      handler = new RDFStatementHandler(graph);
      errorListener = new RDFParseErrorListener(warnings, errors);
      namespaceListener = new RDFNamespaceListener(namespaces);
   parser.setVerifyData(true);
   parser.setStopAtFirstError(false);
   parser.setParseErrorListener(errorListener);
   parser.setNamespaceListener(namespaceListener);  
   parser.setStatementHandler(handler);
  }
 
开发者ID:natsteinmetz,项目名称:ROSE,代码行数:15,代码来源:RDFParser.java

示例14: setUp

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	super.setUp();
	factory = new EntityFactoryImpl();
	// create reasoner with default reasoning engine IRIS
	reasoner = new RDFSReasonerFactoryImpl().createRDFReasoner();
	graph = new GraphImpl();
}
 
开发者ID:natsteinmetz,项目名称:ROSE,代码行数:9,代码来源:RDFEntailmentTest.java

示例15: setUp

import org.openrdf.model.impl.GraphImpl; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	super.setUp();
	factory = new EntityFactoryImpl();
	// create reasoner with default reasoning engine IRIS
	reasoner = new RDFSReasonerFactoryImpl().createERDFSReasoner();
	graph = new GraphImpl();
}
 
开发者ID:natsteinmetz,项目名称:ROSE,代码行数:9,代码来源:ERDFSEntailmentTest.java


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