如何将rdf文件转换为hive表

时间:2014-02-22 16:02:32

标签: mapreduce hive rdf owl ontology

我必须将RDF文件转换为hive或hbase表并将MapReduce作业应用于它。我知道如何操纵配置单元,但我不知道如何将三元组放入行和列。以下RDF文件(来自DBpedia)包含多个三元组。

<rdf:RDF
        xmlns = "http://dbpedia.org/ontology/"
        xml:base="http://dbpedia.org/ontology/"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">

    <!-- Ontology Information -->
    <owl:Ontology rdf:about="">
      <owl:versionInfo xml:lang="de">Version 3.2 2008-11-17</owl:versionInfo>
    </owl:Ontology>

    <owl:Class rdf:about="http://dbpedia.org/ontology/PopulatedPlace">
      <rdfs:label xml:lang="en">Populated Place</rdfs:label>
      <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/Place"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/Place">
    <rdfs:label xml:lang="en">Place</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/Country">
    <rdfs:label xml:lang="en">Country</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/PopulatedPlace"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/Area">
    <rdfs:label xml:lang="en">Area</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/PopulatedPlace"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/Municipality">
    <rdfs:label xml:lang="en">Municipality</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/PopulatedPlace"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/City">
    <rdfs:label xml:lang="en">City</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/PopulatedPlace"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/River">
    <rdfs:label xml:lang="en">River</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/Place"/>
    </owl:Class>

    <owl:Class rdf:about="http://dbpedia.org/ontology/HistoricPlace">
    <rdfs:label xml:lang="en">Historic Place</rdfs:label>
        <rdfs:subClassOf rdf:resource="http://dbpedia.org/ontology/Place"/>
    </owl:Class>
</rdf:RDF>

0 个答案:

没有答案