java - 为 RDF 爬网程序导入类时出错

标签 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.;这里发生错误

最佳答案

我在 google 上搜索了您尝试导入的软件包,看来您正在使用 Kaon。假设是这样,那么您在导入声明中犯了错误。你有:

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

而 SourceForge 上提供的下载则需要:

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

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

关于java - 为 RDF 爬网程序导入类时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5902374/

相关文章:

java - 如何用Java swt创建黄色提示?

javascript - DELETE 请求时参数为 NULL

Java:将字符串转换为现有的最终对象

rdf - 本体中实体的排序

R中的RDF整数

classpath - 用 Jena 创建一个新的本体

java - PhoneGap handle 后退按钮不关闭应用程序

rdf - 如何使用 SPARQL 查找相似内容

java - 使用Java jena插入SPARQL查询以在fuseki中上传三元组

rdf - 奇怪的 Apache Jena 可选行为