Reading RDF
Reading RDF graphs revolves around the from* and add_from* methods, where the wildcard * is one of string, url or filename. The from* methods are static methods and create a new RDF graph while the add_from* methods add to the existing RDF graph.
When reading RDF, you must pass the name of which parser you would like to use. The default is the “guess” parser, which will try to figure out which syntax you’ve given it. However, the guess parser is imperfect, so if you know which syntax you are reading, you can specify this as an argument. The accepted formats are:
rdfxml, ntriples, turtle, trig, rss-tag-soup, grddl, guess, rdfa, nquads, guess, ,
Reading from a string
Read from a string in Python
from pyomexmeta import RDF, eUriType
rdf_str = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#>
<http://purl.org/dc/terms/creator> <https://orcid.org/1234-1234-1234-1234> ."""
# read the annotations into RDF graph
rdf = RDF.from_string(rdf_str, syntax="turtle")
# serialize the string to rdfxml-abbrev
xml_string = rdf.to_string("rdfxml-abbrev")
print(f"RDF graph serialized to rdfxml abbreviated is:\n\n{xml_string}")
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#">
<ns1:creator xmlns:ns1="http://purl.org/dc/terms/"
rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
</rdf:RDF>
Read from a string in C++
#include "omexmeta/RDF.h" // omexmeta::RDF
#include <iostream> // std::cout, std::endl
using namespace omexmeta;
int main(){
std::string rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#>\n"
" <http://purl.org/dc/terms/creator> <https://orcid.org/1234-1234-1234-1234> .\n\n";
// read the turtle string into RDF graph
RDF rdf = RDF::fromString(rdf_str, "turtle");
// serialize to rdfxml abbreviated
std::string rdfxml_abbrev_string = rdf.toString("rdfxml-abbrev");
std::cout << "RDF graph serialized to rdfxml abbreviated is:\n\n" << rdfxml_abbrev_string << std::endl;
return 0;
}
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#">
<ns1:creator xmlns:ns1="http://purl.org/dc/terms/"
rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
</rdf:RDF>
Read from a string in C
#include "omexmeta/OmexMetaCApi.h" // omexmeta::RDF
using namespace omexmeta;
int main(){
const char* rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#>\n"
" <http://purl.org/dc/terms/creator> <https://orcid.org/1234-1234-1234-1234> .\n\n";
// uses dynamic memory
RDF *rdf_ptr = RDF_fromString(rdf_str, "turtle");
// serialize the string to rdfxml
char* xml_string = RDF_toString(rdf_ptr, "rdfxml-abbrev");
printf("RDF graph serialized to rdfxml abbreviated is:\n\n%s", xml_string);
// clean up
free(xml_string);
RDF_delete(rdf_ptr);
return 0;
}
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#">
<ns1:creator xmlns:ns1="http://purl.org/dc/terms/"
rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
</rdf:RDF>
Adding from a string
Read from a string and add to existing graph in Python
from pyomexmeta import RDF, eUriType
rdf_str1 = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#>
<http://purl.org/dc/terms/creator> <https://orcid.org/1234-1234-1234-1234> ."""
rdf_str2 = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0001>
bqbiol:is <https://identifiers.org/uniprot/PD12345> ."""
# read the first string into our RDF graph
rdf = RDF.from_string(rdf_str1, syntax="turtle")
# Add to our RDF graph by reading the second string
rdf.add_from_string(rdf_str2)
# serialize the string to rdfxml-abbrev
xml_string = rdf.to_string("rdfxml-abbrev")
print(f"RDF graph serialized to rdfxml abbreviated is:\n\n{xml_string}")
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#">
<ns1:creator xmlns:ns1="http://purl.org/dc/terms/"
rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0001">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>
Read from a string and add to existing graph in C++
#include "omexmeta/RDF.h" // omexmeta::RDF
#include <iostream> // std::cout, std::endl
using namespace omexmeta;
int main(){
std::string rdf_str1 = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"@prefix dc: <http://purl.org/dc/terms/> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml>\n"
" dc:creator <https://orcid.org/1234-1234-1234-1234> .\n";
std::string rdf_str2 = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
// read the first string into our RDF graph
RDF rdf = RDF::fromString(rdf_str1, "turtle");
// Add to our RDF graph by reading the second string
rdf.addFromString(rdf_str2, "turtle");
// serialize to rdfxml abbreviated
std::string rdfxml_abbrev_string = rdf.toString("rdfxml-abbrev");
std::cout << "RDF graph serialized to rdfxml abbreviated is:\n\n" << rdfxml_abbrev_string << std::endl;
return 0;
}
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml">
<dc:creator rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>
Read from a string and add to existing graph in C
#include "omexmeta/OmexMetaCApi.h" // omexmeta::RDF
#include <cstdio> // printf
using namespace omexmeta;
int main(){
const char* rdf_str1 = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"@prefix dc: <http://purl.org/dc/terms/> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml>\n"
" dc:creator <https://orcid.org/1234-1234-1234-1234> .\n";
const char* rdf_str2 = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0001>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
// read the first string into our RDF graph
RDF* rdf_ptr = RDF_fromString(rdf_str1, "turtle");
// Add to our RDF graph by reading the second string
RDF_addFromString(rdf_ptr, rdf_str2, "turtle");
// serialize the string to rdfxml
char* xml_string = RDF_toString(rdf_ptr, "rdfxml-abbrev");
printf("RDF graph serialized to rdfxml abbreviated is:\n\n%s", xml_string);
// clean up
free(xml_string);
RDF_delete(rdf_ptr);
return 0;
}
Output
RDF graph serialized to rdfxml abbreviated is:
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml">
<dc:creator rdf:resource="https://orcid.org/1234-1234-1234-1234"/>
</rdf:Description>
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0001">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>
Reading from a file
Read from a file in Python
from pyomexmeta import RDF, eUriType
import os
rdf_str = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>
bqbiol:is <https://identifiers.org/uniprot/PD12345> ."""
# we write the annotations to file, so we can read it in from file
# filename is in same directory as your python script
fname = os.path.join(os.path.dirname(__file__), "annotations.rdf")
# write turtle syntax to file
with open (fname, "w") as f:
f.write(rdf_str)
# Add to our RDF graph by reading the second string
rdf = RDF.from_file(fname, "turtle")
print(f"{len(rdf)} triples read from file")
# remove the file we wrote
if os.path.isfile(fname):
os.remove(fname)
Output
1 triples read from file
Read from a file in C++
#include "omexmeta/RDF.h" // omexmeta::RDF
#include <iostream> // std::cout, std::endl
using namespace omexmeta;
int writeToFile(std::string fname);
int writeToFile(std::string fname){
std::string rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
std::ofstream annot_file;
annot_file.open(fname);
annot_file << rdf_str;
annot_file.close();
return 0;
}
int main(){
// note: you need C++17 standard minimum to use std::filesystem
std::filesystem::path fname = std::filesystem::current_path() /+ "annotation_file.rdf";
// write to file
writeToFile(fname.string());
// create an RDF graph
RDF rdf = RDF::fromFile(fname.string(), "turtle"); // assume the content of annotation_file is turtle
std::cout << rdf.size() << " triples read from file" << std::endl;
// RDF clears up after itself via RAII
return 0;
}
Output
ttle:@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>
<http://biomodels.net/biology-qualifiers/is> <https://identifiers.org/uniprot/PD12345> .
1 triples read from file
Read from a file in C
#include "omexmeta/OmexMetaCApi.h" // omexmeta::RDF
using namespace omexmeta;
int writeToFile(const char* fname) {
const char *rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
FILE *fp;
int i;
/* open the file for writing*/
fp = fopen(fname, "w");
for (i = 0; i < 10; i++) {
fprintf(fp, "%s", rdf_str);
}
/* close the file*/
fclose(fp);
return 0;
}
int main(){
std::filesystem::path fname = std::filesystem::current_path() /+ "annotation_file.rdf";
writeToFile(fname.string().c_str());
// read the string into our RDF graph
RDF* rdf_ptr = RDF_fromFile( fname.string().c_str(), "turtle");
printf("%d triples read from file", rdf_ptr->size());
// clear up the file we wrote
remove(fname.string().c_str());
// clear up rdf
RDF_delete(rdf_ptr);
return 0;
}
Output
1 triples read from file
Adding from a file
Read from a file and add to existing graph in Python
from pyomexmeta import RDF, eUriType
import os
rdf_str = """@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .
@prefix OMEXlib: <http://omex-library.org/> .
@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .
@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .
<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>
bqbiol:is <https://identifiers.org/uniprot/PD12345> ."""
# create an empty RDF graph
rdf = RDF()
# we write the annotations to file, so we can read it in from file
# filename is in same directory as your python script
fname = os.path.join(os.path.dirname(__file__), "annotations.rdf")
# write turtle syntax to file
with open (fname, "w") as f:
f.write(rdf_str)
# Add to our RDF graph by reading the second string
rdf.add_from_file(fname, "turtle")
# print out annotations in turtle syntax
rdfxml_abbrev_string = rdf.to_string("rdfxml-abbrev")
print(rdfxml_abbrev_string)
# remove the file we wrote
if os.path.isfile(fname):
os.remove(fname)
Output
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>
Read from a file and add to existing graph in C++
#include "omexmeta/OmexMeta.h" // omexmeta::RDF
#include <iostream> // std::cout, std::endl
#include <filesystem>
using namespace omexmeta;
int writeToFile(const std::string& fname);
int writeToFile(const std::string& fname){
std::string rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
std::ofstream annot_file;
annot_file.open(fname);
annot_file << rdf_str;
annot_file.close();
return 0;
}
int main(){
// create an empty rdf graph
RDF rdf = RDF();
// note: you need C++17 standard minimum to use std::filesystem
std::filesystem::path fname = std::filesystem::current_path() /+ "annotation_file.rdf";
// write some annotations to a file so we can read it in with add from file
writeToFile(fname.string());
// Add to our RDF graph
rdf.addFromFile(fname.string(), "turtle"); // assume the content of annotation_file is turtle
// clear up file we wrote
remove(fname.string().c_str());
std::string xml_abbrev_string = rdf.toString("rdfxml-abbrev");
// Write rdf graph to rdfxml and print to console
std::cout << xml_abbrev_string << std::endl;
// RDF clears up after itself via RAII
return 0;
}
Output
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>
Read from a file and add to existing graph in C
#include <cstdio>
#include "omexmeta/OmexMetaCApi.h"
#include <filesystem>
using namespace omexmeta;
int writeToFile(const char* fname);
int writeToFile(const char* fname) {
const char *rdf_str = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
"@prefix bqbiol: <http://biomodels.net/biology-qualifiers/> .\n"
"@prefix OMEXlib: <http://omex-library.org/> .\n"
"@prefix myOMEX: <http://omex-library.org/NewOmex.omex/> .\n"
"@prefix local: <http://omex-library.org/NewOmex.omex/NewModel.rdf#> .\n"
"\n"
"<http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000>\n"
" bqbiol:is <https://identifiers.org/uniprot/PD12345> .\n";
FILE *fp;
int i;
/* open the file for writing*/
fp = fopen(fname, "w");
for (i = 0; i < 10; i++) {
fprintf(fp, "%s", rdf_str);
}
/* close the file*/
fclose(fp);
return 0;
}
int main() {
// here we cheat and use C++ to get filepath that will work on all systems (>C++17)
std::filesystem::path fname = std::filesystem::current_path() /+ "annotation_file.rdf";
// write to file
writeToFile(fname.string().c_str());
// create an RDF graph so we have something to add to
RDF* rdf_ptr = RDF_new();
// Add to our RDF graph
RDF_addFromFile(rdf_ptr, fname.string().c_str(), "turtle");// assume the content of annotation_file is turtle
// generate some output
char*rdfxml_string = RDF_toString(rdf_ptr, "rdfxml-abbrev");
// print to console
printf("%s", rdfxml_string);
// free dynamically generated output string
free(rdfxml_string);
// clear up the file we wrote
remove(fname);
// clear up rdf
RDF_delete(rdf_ptr);
return 0;
}
Output
<?xml version="1.1" encoding="utf-8"?>
<rdf:RDF xmlns:OMEXlib="http://omex-library.org/"
xmlns:bqbiol="http://biomodels.net/biology-qualifiers/"
xmlns:local="http://omex-library.org/NewOmex.omex/NewModel.rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://omex-library.org/NewOmex.omex/NewModel.xml#OmexMetaId0000">
<bqbiol:is rdf:resource="https://identifiers.org/uniprot/PD12345"/>
</rdf:Description>
</rdf:RDF>