이 프로그램은 추론에 의해 추론 된 다른 사자 개인을 온톨로지에 추가하기 위해 유추 기술을 사용할 수 있지만 반환 된 모든 오류를 해결하는 방법을 알지 못합니다. 자바 코드는 다음과 같다 : :)이클립스에서 sparql 쿼리를 사용하여 새로운 개인을 추론하는 방법
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/acer/Desktop/apache-jena-2.11.1/apache-jena-2.11.1/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/acer/Downloads/Compressed/pellet-2.3.1/pellet-2.3.1/lib/jena/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Exception in thread "main" org.apache.jena.riot.RiotException: <C:/Users/acer/workspace/paletrasi/src/paletrasi/junglejena.owl> Code: 11/LOWERCASE_PREFERRED in SCHEME: lowercase is preferred in this component
at org.apache.jena.riot.system.IRIResolver.exceptions(IRIResolver.java:299)
at org.apache.jena.riot.system.IRIResolver.access$000(IRIResolver.java:31)
at org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.resolve(IRIResolver.java:402)
at org.apache.jena.riot.system.IRIResolver$IRIResolverSync.resolve(IRIResolver.java:437)
at org.apache.jena.riot.system.IRIResolver.resolveIRI(IRIResolver.java:178)
at org.apache.jena.riot.system.IRIResolver.resolveString(IRIResolver.java:169)
at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:128)
at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:141)
at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:859)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:255)
at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:241)
at org.apache.jena.riot.adapters.RDFReaderRIOT_Web.read(RDFReaderRIOT_Web.java:96)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:241)
at paletrasi.jungle2.main(jungle2.java:32)
모든 도움이 apreciated되어 미리 에 감사 :
package paletrasi;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.RDF;
import org.apache.jena.atlas.io.IndentedWriter;
import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.InfModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.reasoner.Reasoner;
import org.mindswap.pellet.jena.PelletReasonerFactory;
public class jungle2
{
public static final String NL = System.getProperty("line.separator") ;
public static void main(String[] args) {
// create the simplest model there is
//
String jungle_file = "C:/Users/acer/workspace/paletrasi/src/paletrasi/junglejena.owl";
// create Pellet reasoner
Reasoner reasoner = PelletReasonerFactory.theInstance().create();
// create an empty model
Model emptyModel = ModelFactory.createDefaultModel();
//create an inferencing model using Pellet reasoner
InfModel m = ModelFactory.createInfModel(reasoner, emptyModel);
//read the file
m.read(jungle_file);
//Model m = ModelFactory.createDefaultModel();
System.out.println("We have loaded a model with no. statements = " + m.size());
String jungle ="http://www.lirmm.fr/jungle#";
String prolog1 = "PREFIX jungle: <"+jungle+">" ;
String prolog2 = "PREFIX rdf: <"+RDF.getURI()+">" ;
//Query string.
String queryString = prolog1 + NL + prolog2 + NL +
"SELECT ?individu WHERE {?individu rdf:type jungle:Lion }" ;
Query query = QueryFactory.create(queryString) ;
//Print with line numbers
query.serialize(new IndentedWriter(System.out,true)) ;
System.out.println() ;
//Create a single execution of this query, apply to a model
//which is wrapped up as a Dataset
QueryExecution qexec = QueryExecutionFactory.create(query, m) ;
//Or QueryExecutionFactory.create(queryString, model) ;
System.out.println("Les Lions : ") ;
try {
//Assumption: it’s a SELECT query.
ResultSet rs = qexec.execSelect() ;
//The order of results is undefined.
for (; rs.hasNext() ;)
{
QuerySolution rb = rs.nextSolution() ;
//Get title - variable names do not include the ’?’
RDFNode y = rb.get("individu");
System.out.print("uri : "+y+"--- ");
Resource z = (Resource) rb.getResource("individu");
System.out.println("plus simplement "+z.getLocalName());
}
}
finally
{
//QueryExecution objects should be closed to free any system resources
qexec.close() ;
}
}}
오류입니다. 이 말한대로
나는 delated했습니다.하지만 예외가 있습니다. 확인하려면 편집을 확인하십시오. – Nanis
@ user3347859 원래 오류가 발견 된 경우 질문을 편집하여 변경하면 안됩니다. 이렇게하면 현재 질문에 대해 원래 질문에 맞는 대답이 잘못됩니다. –