Skip to content
Permalink
Browse files
Resolve merge conflict between master and ANY23-320
  • Loading branch information
lewismc committed Jan 3, 2018
2 parents 60e93a7 + d2ace9c commit 46408604a18ec289e252093a67f5ea010eed4488
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
@@ -42,6 +42,8 @@ public class YAML extends Vocabulary {
public static final String MAPPING = "Mapping";

public static final String CONTAINS = "contains";

public static final String NULL = "Null";

private static final YAML _instance = new YAML();

@@ -80,5 +82,6 @@ public static YAML getInstance() {
public final IRI mapping = createClass(NS, MAPPING);
// property
public final IRI contains = createProperty(NS, CONTAINS);

}

public final IRI nullValue = createProperty(NS, NULL);
}
@@ -106,16 +106,15 @@ private ModelHolder asModelHolder(Value v, Model m) {
*/
@SuppressWarnings("unchecked")
public ModelHolder asModel(IRI namespace, final Object t, Value rootNode) {
if (t == null) {
return null;
}

if (t instanceof List) {
return processList(namespace, (List<Object>) t);
} else if (t instanceof Map) {
return processMap(namespace, (Map<String, Object>) t, rootNode);
} else if (t instanceof String) {
return asModelHolder(RDFUtils.makeIRI(t.toString()), modelFactory.createEmptyModel());
} else if (t == null) {
return asModelHolder(vocab.nullValue, modelFactory.createEmptyModel());
} else {
return asModelHolder(Literals.createLiteral(vf, t), modelFactory.createEmptyModel());
}
@@ -217,7 +216,6 @@ protected ModelHolder processList(IRI ns, List<Object> object) {
prevNode = currentNode;
}

finalModel.add((Resource) listRoot, RDF.TYPE, RDF.LIST, (Resource[]) null);
return asModelHolder(listRoot, finalModel);
}

@@ -24,7 +24,6 @@
import org.eclipse.rdf4j.model.Literal;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.Rio;
@@ -107,12 +107,8 @@ public void nullTest()
assertExtract("/org/apache/any23/extractor/yaml/test-null.yml");
log.debug(dumpModelToTurtle());
assertModelNotEmpty();
/**
* Since the map is empty it should not contain any document marked type mapping.
*/
assertNotContains(RDF.TYPE, vocab.mapping);
int statements = dumpAsListOfStatements().size();
Assert.assertTrue("Found " + statements + " statements", statements == 9);
Assert.assertTrue("Found " + statements + " statements", statements == 26);
}

@Test
@@ -125,7 +121,6 @@ public void treeTest() throws Exception {
RDFUtils.triple(RDFUtils.bnode(), RDFUtils.iri(ns, "value3"), RDFUtils.bnode("10")),
RDFUtils.triple(RDFUtils.bnode("10"), RDF.FIRST, RDFUtils.bnode("11")),
RDFUtils.triple(RDFUtils.bnode("11"), RDFUtils.iri(ns, "key3.1"), RDFUtils.bnode("12")),
RDFUtils.triple(RDFUtils.bnode("12"), RDF.TYPE, RDF.LIST),
RDFUtils.triple(RDFUtils.bnode("12"), RDF.FIRST, RDFUtils.literal("value3.1.1"))
});

@@ -43,7 +43,7 @@ public class RDFSchemaUtilsTest {
*/
@Test
public void testSerializeVocabulariesNTriples() {
serializeVocabularies(RDFFormat.NTRIPLES, 2172);
serializeVocabularies(RDFFormat.NTRIPLES, 2174);
}

/**
@@ -53,7 +53,7 @@ public void testSerializeVocabulariesNTriples() {
*/
@Test
public void testSerializeVocabulariesRDFXML() {
serializeVocabularies(RDFFormat.RDFXML, 5694); // Effective lines + separators.
serializeVocabularies(RDFFormat.RDFXML, 5699); // Effective lines + separators.
}

private void serializeVocabularies(RDFFormat format, int expectedLines) {
@@ -2,4 +2,6 @@
---
canonical: null
tag: !!null
practice:
practice:
some testing:
values: [Very, sour, null]

0 comments on commit 4640860

Please sign in to comment.