本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}