Change Model writer lang from "N3-PP" to "N3" (#149)
Resolves: https://jira.lyrasis.org/browse/VIVO-1761 Co-authored-by: Andrew Woods <awoods@duraspace.org>
This commit is contained in:
parent
edef9309ab
commit
6d30a0fcd4
2 changed files with 41 additions and 2 deletions
|
@ -57,7 +57,7 @@ public class AdditionsAndRetractions {
|
||||||
str += "\nadditions:[";
|
str += "\nadditions:[";
|
||||||
if( getAdditions() != null ) {
|
if( getAdditions() != null ) {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
getAdditions().write(writer, "N3-PP");
|
getAdditions().write(writer, "N3");
|
||||||
str += "\n" + writer.toString() + "\n";
|
str += "\n" + writer.toString() + "\n";
|
||||||
}
|
}
|
||||||
str += "],\n";
|
str += "],\n";
|
||||||
|
@ -65,7 +65,7 @@ public class AdditionsAndRetractions {
|
||||||
str += "\nretractions:[";
|
str += "\nretractions:[";
|
||||||
if( getRetractions() != null ) {
|
if( getRetractions() != null ) {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
getRetractions().write(writer, "N3-PP");
|
getRetractions().write(writer, "N3");
|
||||||
str += "\n" + writer.toString() + "\n";
|
str += "\n" + writer.toString() + "\n";
|
||||||
}
|
}
|
||||||
str += "],\n";
|
str += "],\n";
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo;
|
||||||
|
|
||||||
|
import org.apache.jena.rdf.model.Model;
|
||||||
|
import org.apache.jena.rdf.model.ModelFactory;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.apache.jena.rdf.model.ResourceFactory.createProperty;
|
||||||
|
import static org.apache.jena.rdf.model.ResourceFactory.createResource;
|
||||||
|
import static org.apache.jena.rdf.model.ResourceFactory.createStatement;
|
||||||
|
import static org.apache.jena.rdf.model.ResourceFactory.createStringLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author awoods
|
||||||
|
* @since 2020-04-01
|
||||||
|
*/
|
||||||
|
public class AdditionsAndRetractionsTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testToString() {
|
||||||
|
Model additions = ModelFactory.createDefaultModel();
|
||||||
|
additions.add(createStatement(
|
||||||
|
createResource("test:add"),
|
||||||
|
createProperty("test:prop"),
|
||||||
|
createStringLiteral("new")));
|
||||||
|
|
||||||
|
Model retractions = ModelFactory.createDefaultModel();
|
||||||
|
retractions.add(createStatement(
|
||||||
|
createResource("test:retract"),
|
||||||
|
createProperty("test:prop"),
|
||||||
|
createStringLiteral("old")));
|
||||||
|
AdditionsAndRetractions aar = new AdditionsAndRetractions(additions, retractions);
|
||||||
|
|
||||||
|
final String s = aar.toString();
|
||||||
|
Assert.assertNotNull(s);
|
||||||
|
Assert.assertTrue(s.contains("test:add"));
|
||||||
|
Assert.assertTrue(s.contains("test:retract"));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue