3 Replies Latest reply: Mar 7, 2012 12:29 PM by JorgeB-Oracle RSS

    Export a model in RDF/XML format without Jena?

    525819
      Hi,

      Are there means to export RDF triples in RDF/XML format without using Jena or any other Java staff?

      Thanks.
        • 1. Re: Export a model in RDF/XML format without Jena?
          JorgeB-Oracle
          Hi,

          It depends on the complexity and size of your triples.

          You can try using spool in sqlplus, try set linesize to 200, but if you have triples longer than that you need to set linesize to the largest triple size you have

          Here is a simple example, but I will leave open to others to comment as this does not do any validation of data


          set echo off
          set pagesize 0
          set feed off
          set linesize 200
          spool family.nt
          SELECT '<'|| s ||'> <'|| p ||'> <'|| o ||'> .' <<-- The html is meesing up the syntax, I can send you an email (jorge.barba@oracle.com)
          FROM TABLE(SEM_MATCH(
          '(?s ?p ?o)',
          SEM_Models('family'),
          null,
          SEM_ALIASES(SEM_ALIAS('','http://www.example.org/family/')),
          null));
          spool off

          Edit the spooled file family.nt and get rid of the query and the spool off lines, so there is only triples
          Regards!
          Jorge

          Edited by: jbarba on Mar 7, 2012 9:42 AM
          • 2. Re: Export a model in RDF/XML format without Jena?
            525819
            Hi Jorge,

            Length of triples should not be a problem.

            What I would like such export utility to do is to create a syntactically correct RDF/XML file [with all namespaces, references, etc] out of my data. This file will later be used as input by our partners, possibly using other RDF-enabled software.

            I know Oracle has very elaborated machinery to handle XML data, that is why I hope to see such an utility within SEM_APIS.

            THanks for your answer
            Dmitry.
            • 3. Re: Export a model in RDF/XML format without Jena?
              JorgeB-Oracle
              Hi Dmitry,

              Unfortunately we do not have the code within SEM_APIS to do the task. This is something we already discussed with Development at some point in a case for another customer.

              What we have for now that you may already are aware of is the use of the jena framework to generate N-Triple or RDF/XML output

              There are a couple of notes:

              How To Use Jena Adapter To Extract A Model To Move From One Database To Another Database (Doc ID 1124288.1)
              How To Move Semantic Models From One Database To Another (Doc ID 1347754.1)

              Same code in those notes can be used to generate RDF/XML changing the line

              model.write(os, "N-TRIPLE");

              to

              model.write(os, "RDF/XML");

              The formats you can output are: "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is represented by null is "RDF/XML".

              I know this implies the extra work of installing java JDK and Jena framework but that is the only way for now.

              Regards!
              Jorge