导入RDF搜寻器的类时出错

时间:2011-05-05 18:19:40

标签: java rdf jena

我正在使用rdf抓取工具,因为我有一个名为:

的类
import edu.unika.aifb.rdf.crawler.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.util.FileManager;

这些是被称为错误的类文件,我尝试使用jena包但我已经附加了,它没有做任何更改。

更新

完整 SampleCrawl.java 类内容:

import java.util.*;
import edu.unika.aifb.rdf.crawler.*;

/**
 * Call this class with 3 arguments - URL to crawl to,
 * depth and time in seconds
 */

public class SampleCrawl {

    /**
     * @param uRI
     * @param depth
     * @param time
     */
    @SuppressWarnings("rawtypes")
    public SampleCrawl(Vector uRI, Vector hf, int depth, int time){

        // Initialize Crawling parameters
        CrawlConsole c = new CrawlConsole(uRI,hf,depth,time);

        // get an ontology file from its local location
        // (OPTIONAL)
        c.setLocalNamespace("http://www.daml.org/2000/10/daml-ont","c:\\temp\\rdf\\schemas\\daml-ont.rdf");

        // set all the paths to get all the results
        c.setLogPath("c:\\temp\\crawllog.xml");
        c.setCachePath("c:\\temp\\crawlcache.txt");
        c.setModelPath("c:\\temp\\crawlmodel.rdf");

        try{
            // crawl and get RDF model
            c.start();

            // This writes all three result files out
            c.writeResults();
        }catch(Exception e){
        }
    }

    /**
     * @param args
     * @throws Exception
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public static void main(String[] args) throws Exception {

        if (args.length != 3) {
            System.err.println("Usage: java  -cp  [JARs]  SampleCrawl  [URL]  [depth:int]  [time:int]");
            System.exit(0);
        }

        Vector uris = new Vector();
        uris.add(args[0]);

        // no host filtering - crawl to all hosts
        Vector hostfilter = null;

        /* You may want to do something else to enable host filtering:
         * Vector hostfilter = new Vector();
         * hostfilter.add("http://www.w3.org");
         */

        int depth = 2;
        int time = 60;
        try {
            depth = Integer.parseInt(args[1]);
            time = Integer.parseInt(args[2]);
        }
        catch (Exception e) {
            System.err.println("Illegal argument types:");
            System.err.println("Argument list: URI:String  depth:int  time(s):int");
            System.exit(0);
        }
        new SampleCrawl(uris,hostfilter,depth,time);
    }
}

问题:
如何在此处添加import edu.unika.aifb.rdf.crawler.;错误

1 个答案:

答案 0 :(得分:2)

我用Google搜索了您要导入的软件包,看来您正在使用Kaon。假设是这样,您在导入声明中出错了。你有:

import edu.unika.aifb.rdf.crawler.*;

而SourceForge上提供的下载需要:

import edu.unika.aifb.rdf.rdfcrawler.*;

顺便说一句,如果你要在你的问题中包含“我正试图在...中使用Kaon的rdfcrawler”这些信息会很有帮助。否则,我们必须尝试在您的设置中猜测重要细节。