看来我能';t将.rdf文件读入OntModel(.rdfs和.owl可以)

看来我能';t将.rdf文件读入OntModel(.rdfs和.owl可以),model,rdf,jena,Model,Rdf,Jena,例外情况: 请看图片。 我怎么办?我没有足够的声誉来发布照片。我不能发布超过2个链接的异常,但我的异常 16:55:37警告OntDocumentManager::尝试读取时出错。Msg是“org.xml.sax.SAXParseException:prolog中不允许包含内容”。 com.hp.hpl.jena.shared.JenaException:org.xml.sax.SAXParseException:prolog中不允许包含内容。所指内容是什么?是data/lov.rdf吗 如果您

例外情况: 请看图片。 我怎么办?我没有足够的声誉来发布照片。我不能发布超过2个链接的异常,但我的异常

16:55:37警告OntDocumentManager::尝试读取时出错。Msg是“org.xml.sax.SAXParseException:prolog中不允许包含内容”。 com.hp.hpl.jena.shared.JenaException:org.xml.sax.SAXParseException:prolog中不允许包含内容。

所指内容是什么?是data/lov.rdf吗

如果您使用的是较旧版本的Jena,它将要求RDF/XML,但该URL将返回您要求的任何未处理的内容。较新的版本已经改变了这一点

否则,样本数据和完整堆栈跟踪将有所帮助

public class List_subPropertyOf {

//static final String inputFileName = "data/dbpedia_3.9.owl";
//static final String inputFileName = "data/wnfull.rdfs";
static final String inputFileName = "data/lov.rdf"; 

public static void main(String args[]) {
    try {
        //create the reasoning model using the base
        OntModel inf = ModelFactory.createOntologyModel();

        // use the FileManager to find the input file
        InputStream in = FileManager.get().open(inputFileName);

        File logFile = new File("List_subPropertyOf.txt");
        PrintStream logPrintStream = new PrintStream(logFile);
        System.setOut(logPrintStream);

        if (in == null) {
            throw new IllegalArgumentException("File: " + inputFileName + " not found");
        }

        inf.read(in, "", "RDF/XML");

        ExtendedIterator properties = inf.listOntProperties();
        while (properties.hasNext()) {


            OntProperty essaProperty = (OntProperty) properties.next();

            System.out.println("Property: " + essaProperty.getLocalName());
            for (Iterator i = essaProperty.listSubProperties(); i.hasNext();) {
                OntProperty c = (OntProperty) i.next();
                System.out.print("   " + c.getLocalName() + "\n");
            } // end for
        }
    } catch (Exception e) {
        System.out.println(e);
    }
}