Java 在Jena SDB中添加规则
我在Java类中设计了一个用于查询Jena SDB的块,但我不知道如何添加规则,规则在类中的文件中。我添加代码Java 在Jena SDB中添加规则,java,sparql,jena,Java,Sparql,Jena,我在Java类中设计了一个用于查询Jena SDB的块,但我不知道如何添加规则,规则在类中的文件中。我添加代码 String jdbcURL = "jdbc:mysql://localhost:3306/ontology"; System.out.println("##### GETUSERSTYPE #####"); JDBC.loadDriverMySQL(); // Setup - make the JDBC connection and read the sto
String jdbcURL = "jdbc:mysql://localhost:3306/ontology";
System.out.println("##### GETUSERSTYPE #####");
JDBC.loadDriverMySQL();
// Setup - make the JDBC connection and read the store description once.
Connection jdbc = makeConnection(jdbcURL) ;
// Make a store description without any connection information.
StoreDesc storeDesc = new StoreDesc(LayoutType.LayoutTripleNodesHash,DatabaseType.MySQL) ;
SDBConnection conn = new SDBConnection(jdbc) ;
Store store = StoreFactory.create(storeDesc, conn) ;
Dataset ds = DatasetStore.create(store) ;
QueryExecution qe = QueryExecutionFactory.create(query, ds) ;
试着在Jena文档中查找——具体地说,是推理文档和汇编文档。注意:SDB不推荐使用,除非您确实必须使用SQL数据库-TDB是更好的选择。我使用的是SQL数据库,我可以解决从数据库加载的数据集中导入模型的问题。谢谢您。