Skip to content

Commit

Permalink
Change Model writer lang from "N3-PP" to "N3" (#149)
Browse files Browse the repository at this point in the history
Resolves: https://jira.lyrasis.org/browse/VIVO-1761

Co-authored-by: Andrew Woods <awoods@duraspace.org>
  • Loading branch information
Andrew Woods and Andrew Woods committed Apr 7, 2020
1 parent edef930 commit 6d30a0f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public String toString(){
str += "\nadditions:[";
if( getAdditions() != null ) {
StringWriter writer = new StringWriter();
getAdditions().write(writer, "N3-PP");
getAdditions().write(writer, "N3");
str += "\n" + writer.toString() + "\n";
}
str += "],\n";

str += "\nretractions:[";
if( getRetractions() != null ) {
StringWriter writer = new StringWriter();
getRetractions().write(writer, "N3-PP");
getRetractions().write(writer, "N3");
str += "\n" + writer.toString() + "\n";
}
str += "],\n";
Expand Down
Original file line number Diff line number Diff line change
@@ -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"));
}
}

0 comments on commit 6d30a0f

Please sign in to comment.