Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
255 views
in Technique[技术] by (71.8m points)

sparql - Is there a way to convert the data format of an RDF vocabulary to SKOS

The rdfs file I'm want to use is cv.rdfs, I want to convert it to SKOS, so I can use it in Maui Indexer

I am a complete noob in the subject. Please help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

SKOS is for organizing concepts, and doesn't deal with properties, it seems, so there's a lot of information in the CV RDFS that doesn't really have a SKOS version. However, it's easy enough to define a mapping for the RDFS classes and generate some data using SPARQL. Here's a possible mapping:

  • rdfs:Class maps to skos:Concept.
  • rdfs:comments map to skos:notes.
  • rdfs:labels map to skos:prefLabels.
  • rdfs:subClassOf maps to skos:broader.

Using that mapping, we can write the following SPARQL which produces the resulting "SKOS document" (it's an RDF document using lots of SKOS vocabulary):

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>

construct {
  ?x a skos:Concept ; ?skosP ?y
}
where {
  values (?rdfsP ?skosP) {
    (rdfs:subClassOf skos:broader)
    (rdfs:label skos:prefLabel)
    (rdfs:comment skos:note)
  }
  ?x a rdfs:Class ; ?rdfsP ?y 
}

In the more human readable Turtle: (The awkward typo "Refernece" is in the cv.rdfs data.)

@prefix cv_base: <http://rdfs.org/resume-rdf/base.rdfs#> .
@prefix a:     <http://protege.stanford.edu/system#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix skos:  <http://www.w3.org/2004/02/skos/core#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ns_1_6: <http://xmlns.com/wordnet/1.6/> .
@prefix cv_rdfs: <http://rdfs.org/resume-rdf/cv.rdfs#> .

cv_rdfs:Person  a       skos:Concept ;
        skos:broader    ns_1_6:Person ;
        skos:note       "CV subclass of WordNet person" ;
        skos:prefLabel  "Person" .

cv_rdfs:Organization  a  skos:Concept ;
        skos:broader    rdfs:Resource ;
        skos:note       "General class for organizations" ;
        skos:prefLabel  "Organization" .

cv_rdfs:Education  a    skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV entry for education" ;
        skos:prefLabel  "Education" .

cv_rdfs:Refernece  a    skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV entry for references" ;
        skos:prefLabel  "Refernece" .

cv_rdfs:PersonalReference
        a               skos:Concept ;
        skos:broader    cv_rdfs:Reference ;
        skos:note       "Personal reference" ;
        skos:prefLabel  "PersonalRefernece" .

cv_rdfs:CV_Entry  a     skos:Concept ;
        skos:broader    rdfs:Resource ;
        skos:note       "Single entry of CV information. Type of CV information specified in subclasses" ;
        skos:prefLabel  "CV_Entry" .

cv_rdfs:Course  a       skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV entry for courses taken" ;
        skos:prefLabel  "Course" .

cv_rdfs:LanguageSkill
        a               skos:Concept ;
        skos:broader    cv_rdfs:Skill ;
        skos:note       "Language skill.
Contains 3 levels for skill: spoken, written, reading.
Inherited skill level used for spoken." ;
        skos:prefLabel  "LanguageSkill" .

cv_rdfs:WorkHistory  a  skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV entry for work history" ;
        skos:prefLabel  "WorkHistory" .

cv_rdfs:EducationalOrg
        a               skos:Concept ;
        skos:broader    cv_rdfs:Organization ;
        skos:note       "Educational organization (university, ...)" ;
        skos:prefLabel  "EducationalOrg" .

cv_rdfs:Target  a       skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV information for target of job application.
(Single entry per CV. May be defined in the properties of CV class instead)." ;
        skos:prefLabel  "Target" .

cv_rdfs:Company  a      skos:Concept ;
        skos:broader    cv_rdfs:Organization ;
        skos:note       "A class for company information." ;
        skos:prefLabel  "Company" .

cv_rdfs:OtherInfo  a    skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "Other information in CV" ;
        skos:prefLabel  "OtherInfo" .

cv_rdfs:Skill  a        skos:Concept ;
        skos:broader    cv_rdfs:CV_Entry ;
        skos:note       "CV entry for description of skills" ;
        skos:prefLabel  "Skill" .

cv_rdfs:ProfessionalReference
        a               skos:Concept ;
        skos:broader    cv_rdfs:Reference ;
        skos:note       "Professional reference" ;
        skos:prefLabel  "ProfessionalRefernece" .

cv_rdfs:CV  a           skos:Concept ;
        skos:broader    ns_1_6:Curriculum_Vitae ;
        skos:note       "CV subclass of WordNet Curriculum Vitae" ;
        skos:prefLabel  "CV" .

And in RDF/XML:

<rdf:RDF
    xmlns:cv_base="http://rdfs.org/resume-rdf/base.rdfs#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:a="http://protege.stanford.edu/system#"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:cv_rdfs="http://rdfs.org/resume-rdf/cv.rdfs#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:ns_1_6="http://xmlns.com/wordnet/1.6/">
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#PersonalReference">
    <skos:note>Personal reference</skos:note>
    <skos:prefLabel>PersonalRefernece</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#Reference"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#OtherInfo">
    <skos:note>Other information in CV</skos:note>
    <skos:prefLabel>OtherInfo</skos:prefLabel>
    <skos:broader>
      <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry">
        <skos:note>Single entry of CV information. Type of CV information specified in subclasses</skos:note>
        <skos:prefLabel>CV_Entry</skos:prefLabel>
        <skos:broader rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
      </skos:Concept>
    </skos:broader>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Person">
    <skos:note>CV subclass of WordNet person</skos:note>
    <skos:prefLabel>Person</skos:prefLabel>
    <skos:broader rdf:resource="http://xmlns.com/wordnet/1.6/Person"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#ProfessionalReference">
    <skos:note>Professional reference</skos:note>
    <skos:prefLabel>ProfessionalRefernece</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#Reference"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#LanguageSkill">
    <skos:note>Language skill.
Contains 3 levels for skill: spoken, written, reading.
Inherited skill level used for spoken.</skos:note>
    <skos:prefLabel>LanguageSkill</skos:prefLabel>
    <skos:broader>
      <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Skill">
        <skos:note>CV entry for description of skills</skos:note>
        <skos:prefLabel>Skill</skos:prefLabel>
        <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
      </skos:Concept>
    </skos:broader>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#WorkHistory">
    <skos:note>CV entry for work history</skos:note>
    <skos:prefLabel>WorkHistory</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#EducationalOrg">
    <skos:note>Educational organization (university, ...)</skos:note>
    <skos:prefLabel>EducationalOrg</skos:prefLabel>
    <skos:broader>
      <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Organization">
        <skos:note>General class for organizations</skos:note>
        <skos:prefLabel>Organization</skos:prefLabel>
        <skos:broader rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
      </skos:Concept>
    </skos:broader>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Refernece">
    <skos:note>CV entry for references</skos:note>
    <skos:prefLabel>Refernece</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Course">
    <skos:note>CV entry for courses taken</skos:note>
    <skos:prefLabel>Course</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#CV">
    <skos:note>CV subclass of WordNet Curriculum Vitae</skos:note>
    <skos:prefLabel>CV</skos:prefLabel>
    <skos:broader rdf:resource="http://xmlns.com/wordnet/1.6/Curriculum_Vitae"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Education">
    <skos:note>CV entry for education</skos:note>
    <skos:prefLabel>Education</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Target">
    <skos:note>CV information for target of job application.
(Single entry per CV. May be defined in the properties of CV class instead).</skos:note>
    <skos:prefLabel>Target</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#CV_Entry"/>
  </skos:Concept>
  <skos:Concept rdf:about="http://rdfs.org/resume-rdf/cv.rdfs#Company">
    <skos:note>A class for company information.</skos:note>
    <skos:prefLabel>Company</skos:prefLabel>
    <skos:broader rdf:resource="http://rdfs.org/resume-rdf/cv.rdfs#Organization"/>
  </skos:Concept>
</rdf:RDF>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...