Skip to content

Commit

Permalink
Implemented saving as RDF N3 (fixes #1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Aug 20, 2009
1 parent 5fa7b6e commit c990863
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Expand Up @@ -11,7 +11,6 @@
package net.bioclipse.rdf.business;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import net.bioclipse.core.PublishedClass;
Expand Down Expand Up @@ -126,6 +125,15 @@ public void addDataProperty(IRDFStore store,
public void saveRDFXML(IRDFStore store, String fileName)
throws BioclipseException;

@Recorded
@PublishedMethod(
params = "IRDFStore store, String fileName",
methodSummary = "Saves the store to a N3 file."
)
@TestMethods("testSaveRDFN3")
public void saveRDFN3(IRDFStore store, String fileName)
throws BioclipseException;

@Recorded
@PublishedMethod(
params = "IRDFStore store, String fileName",
Expand Down
Expand Up @@ -251,6 +251,18 @@ public IFile saveRDFXML(IRDFStore store, IFile file,
return saveRDF(store, file, "RDF/XML-ABBREV", monitor);
}

public void saveRDFN3(IRDFStore store, String fileName)
throws BioclipseException {
IFile file = ResourcePathTransformer.getInstance().transform(fileName);
saveRDFN3(store, file, null);
};

public IFile saveRDFN3(IRDFStore store, IFile file,
IProgressMonitor monitor)
throws BioclipseException {
return saveRDF(store, file, "N3", monitor);
}

public void saveRDFNTriple(IRDFStore store, String fileName)
throws BioclipseException {
IFile file = ResourcePathTransformer.getInstance().transform(fileName);
Expand All @@ -269,8 +281,9 @@ public IFile saveRDF(IRDFStore store, IFile file,
throws BioclipseException {

if (type == null && !"RDF/XML-ABBREV".equals(type) &&
!"N-TRIPLE".equals(type))
throw new BioclipseException("Can only save RDF/XML-ABBREV " +
!"N-TRIPLE".equals(type) &&
!"N3".equals(type))
throw new BioclipseException("Can only save RDF/XML-ABBREV, N3, " +
"and N-TRIPLE.");

if (file.exists()) {
Expand Down

0 comments on commit c990863

Please sign in to comment.