Fetches and Translates rdf data from RDB using D2RMap.
java org.vivoweb.harvester.fetch.D2RMapFetch -o config/recordHandlers/JDBCXMLRecordHandler.xml -u config/tasks/D2RMapFetchTask.d2r.xml -s person.rdf |
See the D2R spec for details of d2r elements.
Example 1:
<?xml version="1.0"?> <d2r:Map xmlns:d2r="http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RMap/0.1#" d2r:versionInfo="$Id: iswcMap.d2r,xml, v 0.1 2003/01/15 19:44:09 Chris Exp $"> <d2r:Prepend><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>]]></d2r:Prepend> <d2r:ProcessorMessage d2r:outputFormat="RDF/XML"/> <d2r:DBConnection d2r:jdbcDriver="com.mysql.jdbc.Driver" d2r:jdbcDSN="jdbc:mysql://localhost:3306/injest_test" d2r:username="user" d2r:password="pw"/> <d2r:Namespace d2r:prefix="owl" d2r:namespace="http://www.w3.org/2002/07/owl#"/> <d2r:Namespace d2r:prefix="rdf" d2r:namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> <d2r:Namespace d2r:prefix="xsd" d2r:namespace="http://www.w3.org/2001/XMLSchema#"/> <d2r:Namespace d2r:prefix="rdfs" d2r:namespace="http://www.w3.org/2000/01/rdf-schema#"/> <d2r:Namespace d2r:prefix="core" d2r:namespace="http://vivoweb.org/ontology/core#"/> <d2r:Namespace d2r:prefix="foaf" d2r:namespace="http://xmlns.com/foaf/0.1/"/> <d2r:Namespace d2r:prefix="vivo" d2r:namespace="http://vivoweb.org/ontology/core#"/> <!-- Person --> <!-- Note: d2r:groupBy and d2r:column Strings needs to be ALL CAPITALS unless running a case sensitive RDBMS like MySQL on Linux/Unix --> <d2r:ClassMap d2r:type="foaf:Person" d2r:sql="select personID as PERSONID, firstName as FIRSTNAME, middleName as MIDDLENAME, lastName as LASTNAME, title as TITLE from injest_test.people" d2r:groupBy="PERSONID" d2r:uriPattern="http://example.org/vivo/individual/@<at:var at:name="PERSONID" />@"> <d2r:DatatypePropertyBridge d2r:property="rdfs:label" d2r:column="PERSONID"/> <d2r:DatatypePropertyBridge d2r:property="foaf:firstName" d2r:column="FIRSTNAME"/> <d2r:DatatypePropertyBridge d2r:property="core:middleName" d2r:column="MIDDLENAME"/> <d2r:DatatypePropertyBridge d2r:property="foaf:lastName" d2r:column="LASTNAME"/> <d2r:DatatypePropertyBridge d2r:property="vivo:preferredTitle" d2r:column="TITLE"/> </d2r:ClassMap> </d2r:Map> |
Example 2:
<?xml version="1.0" encoding="UTF-8"?> <d2r:Map xmlns:d2r="http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RMap/0.1#" d2r:versionInfo="$Id: iswcMap.d2r,xml, v 0.1 2003/01/15 19:44:09 Chris Exp $"> <d2r:ProcessorMessage d2r:outputFormat="RDF/XML"/> <d2r:DBConnection d2r:jdbcDriver="oracle.jdbc.driver.OracleDriver" d2r:jdbcDSN="jdbc:oracle:thin:@ldap://***/***,cn=OracleContext,ou=services,o=***" d2r:username="***" d2r:password="***"/> <d2r:Namespace d2r:prefix="owl" d2r:namespace="http://www.w3.org/2002/07/owl#"/> <d2r:Namespace d2r:prefix="rdf" d2r:namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> <d2r:Namespace d2r:prefix="xsd" d2r:namespace="http://www.w3.org/2001/XMLSchema#"/> <d2r:Namespace d2r:prefix="rdfs" d2r:namespace="http://www.w3.org/2000/01/rdf-schema#"/> <d2r:Namespace d2r:prefix="core" d2r:namespace="http://vivoweb.org/ontology/core#"/> <d2r:Namespace d2r:prefix="foaf" d2r:namespace="http://xmlns.com/foaf/0.1/"/> <d2r:Namespace d2r:prefix="wcmc" d2r:namespace="http://weill.cornell.edu/vivo/ontology/wcmc#"/> <d2r:Namespace d2r:prefix="j.0" d2r:namespace="http://vitro.mannlib.cornell.edu/ns/wcmc/people/"/> <d2r:Namespace d2r:prefix="j.6" d2r:namespace="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"/> <!-- WCMC Consortium --> <d2r:ClassMap d2r:id="ConsortiumParent" d2r:type="core:University" d2r:sql="select DB.ORG.ofa_institute_fk as OFA_INSTITUTE_FK, DB.ORG.vivo_organization_name as ORGANIZATION_NAME, DB.VIVO_ORGUNIT_PREFIX.vivo_orgunit_prefix_name as PREFIX_NAME, DB.VIVO_UNIT.vivo_unit_pk as UNIT_PK from DB.ORG inner join DB.VIVO_ORGUNIT_PREFIX on DB.ORG.vivo_orgunit_prefix_fk=DB.VIVO_ORGUNIT_PREFIX.vivo_orgunit_prefix_pk inner join DB.VIVO_UNIT on DB.VIVO_UNIT.vivo_organization_fk=DB.ORG.vivo_organization_pk where DB.ORG.vivo_organization_pk=90041" d2r:groupBy="OFA_INSTITUTE_FK" d2r:uriPattern="http://vivo.med.cornell.edu/individual/org-@<at:var at:name="OFA_INSTITUTE_FK" />@"> <d2r:DatatypePropertyBridge d2r:property="rdfs:label" d2r:column="ORGANIZATION_NAME"/> <d2r:ObjectPropertyBridge d2r:property="core:hasSubOrganization" d2r:referredClass="ConsortiumChild" d2r:referredGroupBy="UNIT_PK"/> </d2r:ClassMap> <d2r:ClassMap d2r:id="ConsortiumChild" d2r:type="core:Consortium" d2r:sql="select DB.VIVO_UNIT.vivo_unit_pk as UNIT_PK, DB.ORG.ofa_institute_fk as OFA_INSTITUTE_FK, DB.VIVO_UNIT.vivo_unit_name as UNIT_NAME, DB.VIVO_UNIT.description as OVERVIEW, DB.VIVO_ORGUNIT_PREFIX.vivo_orgunit_prefix_name as PREFIX_NAME from DB.VIVO_UNIT inner join DB.VIVO_ORGUNIT_PREFIX on DB.VIVO_UNIT.vivo_orgunit_prefix_fk=DB.VIVO_ORGUNIT_PREFIX.vivo_orgunit_prefix_pk inner join DB.ORG on DB.VIVO_UNIT.vivo_organization_fk=DB.ORG.vivo_organization_pk where DB.VIVO_ORGUNIT_PREFIX.vivo_orgunit_prefix_pk=13 and DB.ORG.vivo_organization_pk=90041" d2r:groupBy="UNIT_PK" d2r:uriPattern="http://vivo.med.cornell.edu/individual/org-u@<at:var at:name="UNIT_PK" />@"> <d2r:DatatypePropertyBridge d2r:property="rdfs:label" d2r:column="UNIT_NAME"/> <d2r:DatatypePropertyBridge d2r:property="core:overview" d2r:column="OVERVIEW"/> <d2r:ObjectPropertyBridge d2r:property="core:subOrganizationWithin" d2r:referredClass="ConsortiumParent" d2r:referredGroupBy="OFA_INSTITUTE_FK"/> </d2r:ClassMap> </d2r:Map> |
This config file redirects any .rdf output to the directory XMLVault/JDBCRDF.
<?xml version="1.0" encoding="UTF-8"?> <RecordHandler type="org.vivoweb.harvester.util.repo.TextFileRecordHandler"> <Param name="fileDir">XMLVault/JDBCRDF</Param> </RecordHandler> |
The file name to use for any rdf output.
The directory for this file should be specified with the Record Handler config file's "fileDir" parameter, which is passed via the -o argument. In this above example, this is set to XMLVault/JDBCRDF.
Override the RH_PARAM of output recordhandler.