我正在使用 OpenLink Virtuoso 软件使用本教程将关系数据库转换为 RDF:Automated Generation of Linked Data Views over Relational Data Sources with Virtuoso
我有一个包含 5 个表( 、、、、、 )的数据库Authors
,我使用 .csv 文件将它们导入 Virtuoso 数据库。Keywords
Publications
References
Rights
所以基本上我已经按照“使用 Conductor 的基于 HTML 的向导手动生成和部署链接数据”的步骤进行操作,因为我需要使用自己的本体,这是为 R2RML 图生成的代码:
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix CSV: <http://localhost:8890/schemas/CSV/> .
@prefix csv-stat: <http://localhost:8890/CSV/stat#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix scovo: <http://purl.org/NET/scovo#> .
@prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
<#TriplesMapAuthors_csv> a rr:TriplesMap;
rr:logicalTable [ rr:tableSchema "CSV" ;
rr:tableOwner "DBA" ; rr:tableName "Authors_csv" ];
rr:subjectMap [ rr:termtype "IRI" ;
rr:template "http://localhost:8890/CSV/authors_csv/ID={ID}";
rr:class CSV:Authors_csv; rr:graph <http://localhost:8890/CSV#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:id ] ;
rr:objectMap [ rr:column "ID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authorid ] ;
rr:objectMap [ rr:column "AuthorID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authorname ] ;
rr:objectMap [ rr:column "AuthorName" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authormidlename ] ;
rr:objectMap [ rr:column "AuthorMidleName" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authorsurname ] ;
rr:objectMap [ rr:column "AuthorSurname" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authorurl ] ;
rr:objectMap [ rr:column "AuthorURL" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authoremail ] ;
rr:objectMap [ rr:column "AuthorEmail" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:csd_dep ] ;
rr:objectMap [ rr:column "CSD_DEP" ]; ] .
<#TriplesMapKeywords_csv> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "CSV" ; rr:tableOwner "DBA" ; rr:tableName "Keywords_csv" ];
rr:subjectMap [ rr:termtype "IRI" ; rr:template "http://localhost:8890/CSV/keywords_csv/ID={ID}"; rr:class CSV:Keywords_csv; rr:graph <http://localhost:8890/CSV#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:id ] ; rr:objectMap [ rr:column "ID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationid ] ; rr:objectMap [ rr:column "PublicationID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:keyword ] ; rr:objectMap [ rr:column "Keyword" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:keywordorder ] ; rr:objectMap [ rr:column "KeywordOrder" ]; ] .
<#TriplesMapPublications_csv> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "CSV" ; rr:tableOwner "DBA" ; rr:tableName "Publications_csv" ];
rr:subjectMap [ rr:termtype "IRI" ; rr:template "http://localhost:8890/CSV/publications_csv/ID={ID}"; rr:class CSV:Publications_csv; rr:graph <http://localhost:8890/CSV#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:id ] ; rr:objectMap [ rr:column "ID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationid ] ; rr:objectMap [ rr:column "PublicationID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationtitle ] ; rr:objectMap [ rr:column "PublicationTitle" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:mediatype ] ; rr:objectMap [ rr:column "MediaType" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationtype ] ; rr:objectMap [ rr:column "PublicationType" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:mediatitle ] ; rr:objectMap [ rr:column "MediaTitle" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:mediapublisher ] ; rr:objectMap [ rr:column "MediaPublisher" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:mediaeditors ] ; rr:objectMap [ rr:column "MediaEditors" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:mediavolinfo ] ; rr:objectMap [ rr:column "MediaVolInfo" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationyear ] ; rr:objectMap [ rr:column "PublicationYear" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationnoofpages ] ; rr:objectMap [ rr:column "PublicationNoOfPages" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationpagesinmedium ] ; rr:objectMap [ rr:column "PublicationPagesInMedium" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationfilename ] ; rr:objectMap [ rr:column "PublicationFileName" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationcomments ] ; rr:objectMap [ rr:column "PublicationComments" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationrelatedurl ] ; rr:objectMap [ rr:column "PublicationRelatedURL" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationrelatedurltext ] ; rr:objectMap [ rr:column "PublicationRelatedURLText" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationlocation ] ; rr:objectMap [ rr:column "PublicationLocation" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationpuburl ] ; rr:objectMap [ rr:column "PublicationPubURL" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:displayonmlkd ] ; rr:objectMap [ rr:column "DisplayOnMLKD" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:displayoniskp ] ; rr:objectMap [ rr:column "DisplayOnISKP" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publishonweb ] ; rr:objectMap [ rr:column "PublishOnWeb" ]; ] .
<#TriplesMapReferences_csv> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "CSV" ; rr:tableOwner "DBA" ; rr:tableName "References_csv" ];
rr:subjectMap [ rr:termtype "IRI" ; rr:template "http://localhost:8890/CSV/references_csv/ID={ID}"; rr:class CSV:References_csv; rr:graph <http://localhost:8890/CSV#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:id ] ; rr:objectMap [ rr:column "ID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:refid ] ; rr:objectMap [ rr:column "RefID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:refpaperid ] ; rr:objectMap [ rr:column "RefPaperID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:refdetails ] ; rr:objectMap [ rr:column "RefDetails" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:refyear ] ; rr:objectMap [ rr:column "RefYear" ]; ] .
<#TriplesMapRights_csv> a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "CSV" ; rr:tableOwner "DBA" ; rr:tableName "Rights_csv" ];
rr:subjectMap [ rr:termtype "IRI" ; rr:template "http://localhost:8890/CSV/rights_csv/ID={ID}"; rr:class CSV:Rights_csv; rr:graph <http://localhost:8890/CSV#> ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:id ] ; rr:objectMap [ rr:column "ID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:publicationid ] ; rr:objectMap [ rr:column "PublicationID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authorid ] ; rr:objectMap [ rr:column "AuthorID" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant CSV:authororder ] ; rr:objectMap [ rr:column "AuthorOrder" ]; ] .
这是本体自动生成的代码:
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix aowl: <http://bblfish.net/work/atom-owl/2006-06-06/> .
@prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
@prefix CSV: <http://localhost:8890/schemas/CSV/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
CSV: a owl:Ontology .
# CSV.DBA.Authors_csv
CSV:Authors_csv a rdfs:Class .
CSV:Authors_csv rdfs:isDefinedBy CSV: .
CSV:Authors_csv rdfs:label "CSV.DBA.Authors_csv" .
CSV:Authors_csv rdfs:subClassOf foaf:Person .
CSV:id a owl:DatatypeProperty .
CSV:id rdfs:range xsd:int .
CSV:id rdfs:domain CSV:Authors_csv .
CSV:id rdfs:isDefinedBy CSV: .
CSV:id rdfs:label "ID" .
CSV:authoremail a owl:DatatypeProperty .
CSV:authoremail rdfs:range xsd:string .
CSV:authoremail rdfs:domain CSV:Authors_csv .
CSV:authoremail rdfs:isDefinedBy CSV: .
CSV:authoremail rdfs:label "AuthorEmail" .
CSV:csd_dep a owl:DatatypeProperty .
CSV:csd_dep rdfs:range xsd:int .
CSV:csd_dep rdfs:domain CSV:Authors_csv .
CSV:csd_dep rdfs:isDefinedBy CSV: .
CSV:csd_dep rdfs:label "CSD_DEP" .
# CSV.DBA.Keywords_csv
CSV:Keywords_csv a rdfs:Class .
CSV:Keywords_csv rdfs:isDefinedBy CSV: .
CSV:Keywords_csv rdfs:label "CSV.DBA.Keywords_csv" .
CSV:id a owl:DatatypeProperty .
CSV:id rdfs:range xsd:int .
CSV:id rdfs:domain CSV:Keywords_csv .
CSV:id rdfs:isDefinedBy CSV: .
CSV:id rdfs:label "ID" .
CSV:publicationid a owl:DatatypeProperty .
CSV:publicationid rdfs:range xsd:int .
CSV:publicationid rdfs:domain CSV:Keywords_csv .
CSV:publicationid rdfs:isDefinedBy CSV: .
CSV:publicationid rdfs:label "PublicationID" .
CSV:keyword a owl:DatatypeProperty .
CSV:keyword rdfs:range xsd:string .
CSV:keyword rdfs:domain CSV:Keywords_csv .
CSV:keyword rdfs:isDefinedBy CSV: .
CSV:keyword rdfs:label "Keyword" .
CSV:keywordorder a owl:DatatypeProperty .
CSV:keywordorder rdfs:range xsd:int .
CSV:keywordorder rdfs:domain CSV:Keywords_csv .
CSV:keywordorder rdfs:isDefinedBy CSV: .
CSV:keywordorder rdfs:label "KeywordOrder" .
# CSV.DBA.Publications_csv
CSV:Publications_csv a rdfs:Class .
CSV:Publications_csv rdfs:isDefinedBy CSV: .
CSV:Publications_csv rdfs:label "CSV.DBA.Publications_csv" .
CSV:Publications_csv rdfs:subClassOf bibo:Article .
CSV:publicationtitle a owl:DatatypeProperty .
CSV:publicationtitle rdfs:range xsd:string .
CSV:publicationtitle rdfs:domain CSV:Publications_csv .
CSV:publicationtitle rdfs:isDefinedBy CSV: .
CSV:publicationtitle rdfs:label "PublicationTitle" .
CSV:mediatype a owl:DatatypeProperty .
CSV:mediatype rdfs:range xsd:string .
CSV:mediatype rdfs:domain CSV:Publications_csv .
CSV:mediatype rdfs:isDefinedBy CSV: .
CSV:mediatype rdfs:label "MediaType" .
CSV:publicationtype a owl:DatatypeProperty .
CSV:publicationtype rdfs:range xsd:int .
CSV:publicationtype rdfs:domain CSV:Publications_csv .
CSV:publicationtype rdfs:isDefinedBy CSV: .
CSV:publicationtype rdfs:label "PublicationType" .
CSV:mediatitle a owl:DatatypeProperty .
CSV:mediatitle rdfs:range xsd:string .
CSV:mediatitle rdfs:domain CSV:Publications_csv .
CSV:mediatitle rdfs:isDefinedBy CSV: .
CSV:mediatitle rdfs:label "MediaTitle" .
CSV:publicationyear a owl:DatatypeProperty .
CSV:publicationyear rdfs:range xsd:int .
CSV:publicationyear rdfs:domain CSV:Publications_csv .
CSV:publicationyear rdfs:isDefinedBy CSV: .
CSV:publicationyear rdfs:label "PublicationYear" .
CSV:publicationfilename a owl:DatatypeProperty .
CSV:publicationfilename rdfs:range xsd:string .
CSV:publicationfilename rdfs:domain CSV:Publications_csv .
CSV:publicationfilename rdfs:isDefinedBy CSV: .
CSV:publicationfilename rdfs:label "PublicationFileName" .
CSV:publicationcomments a owl:DatatypeProperty .
CSV:publicationcomments rdfs:range xsd:string .
CSV:publicationcomments rdfs:domain CSV:Publications_csv .
CSV:publicationcomments rdfs:isDefinedBy CSV: .
CSV:publicationcomments rdfs:label "PublicationComments" .
CSV:displayonmlkd a owl:ObjectProperty .
CSV:displayonmlkd rdfs:range aowl:Content .
CSV:displayonmlkd rdfs:domain CSV:Publications_csv .
CSV:displayonmlkd rdfs:isDefinedBy CSV: .
CSV:displayonmlkd rdfs:label "DisplayOnMLKD" .
CSV:displayoniskp a owl:ObjectProperty .
CSV:displayoniskp rdfs:range aowl:Content .
CSV:displayoniskp rdfs:domain CSV:Publications_csv .
CSV:displayoniskp rdfs:isDefinedBy CSV: .
CSV:displayoniskp rdfs:label "DisplayOnISKP" .
CSV:publishonweb a owl:ObjectProperty .
CSV:publishonweb rdfs:range aowl:Content .
CSV:publishonweb rdfs:domain CSV:Publications_csv .
CSV:publishonweb rdfs:isDefinedBy CSV: .
CSV:publishonweb rdfs:label "PublishOnWeb" .
# CSV.DBA.References_csv
CSV:References_csv a rdfs:Class .
CSV:References_csv rdfs:isDefinedBy CSV: .
CSV:References_csv rdfs:label "CSV.DBA.References_csv" .
CSV:References_csv rdfs:subClassOf bibo:ReferenceSource .
CSV:refyear a owl:DatatypeProperty .
CSV:refyear rdfs:range xsd:int .
CSV:refyear rdfs:domain CSV:References_csv .
CSV:refyear rdfs:isDefinedBy CSV: .
CSV:refyear rdfs:label "RefYear" .
# CSV.DBA.Rights_csv
CSV:Rights_csv a rdfs:Class .
CSV:Rights_csv rdfs:isDefinedBy CSV: .
CSV:Rights_csv rdfs:label "CSV.DBA.Rights_csv" .
CSV:Rights_csv rdfs:subClassOf dcterms:RightsStatement .
CSV:id a owl:DatatypeProperty .
CSV:id rdfs:range xsd:int .
CSV:id rdfs:domain CSV:Rights_csv .
CSV:id rdfs:isDefinedBy CSV: .
CSV:id rdfs:label "ID" .
CSV:publicationid a owl:DatatypeProperty .
CSV:publicationid rdfs:range xsd:int .
CSV:publicationid rdfs:domain CSV:Rights_csv .
CSV:publicationid rdfs:isDefinedBy CSV: .
CSV:publicationid rdfs:label "PublicationID" .
CSV:authorid a owl:DatatypeProperty .
CSV:authorid rdfs:range xsd:int .
CSV:authorid rdfs:domain CSV:Rights_csv .
CSV:authorid rdfs:isDefinedBy CSV: .
CSV:authorid rdfs:label "AuthorID" .
CSV:authororder a owl:DatatypeProperty .
CSV:authororder rdfs:range xsd:int .
CSV:authororder rdfs:domain CSV:Rights_csv .
CSV:authororder rdfs:isDefinedBy CSV: .
CSV:authororder rdfs:label "AuthorOrder" .
在“转换”结束时,它显示了结果正常的操作状态,并为我提供了以下链接:
SQL 关系(表)到 RDF 语句(谓词/属性图)映射
http://localhost:8890/schemas/CSV/qm-authors_csv
http://localhost:8890/schemas/CSV/qm-keywords_csv
http://localhost:8890/schemas/CSV/qm-publications_csv
http://localhost:8890/schemas/CSV/qm-references_csv
http://localhost:8890/schemas/CSV/qm-rights_csv
http://localhost:8890/schemas/CSV/qm-VoidStatistics
示例图 IRI 和关联数据实体 URI
RDFDocument(命名图)IRIs:
Transient Views: http://localhost:8890/CSV#
http://localhost:8890/CSV/authors_csv/ID/1#this
http://localhost:8890/CSV/authors_csv/ID/1#this
http://localhost:8890/CSV/keywords_csv/ID/1#this
http://localhost:8890/CSV/publications_csv/ID/1#this
http://localhost:8890/CSV/publications_csv/ID/1#this
http://localhost:8890/CSV/objects/publications_csv/ID/1/DisplayOnMLKD.bin
http://localhost:8890/CSV/references_csv/ID/1#this
http://localhost:8890/CSV/references_csv/ID/1#this
http://localhost:8890/CSV/rights_csv/ID/1#this
http://localhost:8890/CSV/rights_csv/ID/1#this
Metadata Data Document (VoiD) URI/URL: http://localhost:8890/CSV/stat#
Linked Data Ontology URI: http://localhost:8890/schemas/CSV/
我尝试使用以下查询来查看所有结果以检查它们:
SELECT *
FROM <http://localhost:8890/CSV>
WHERE {?s ?o ?p}
上面的查询返回什么,只有 3 个标题为 s,o,p 的空列。
问题:
因此,基于上述结果,我如何才能找到我的图表的存储位置以及我应该在我的 Virtuoso 端点上使用哪些 SPARQL 查询来查看我的结果?