Repository: any23 Updated Branches: refs/heads/master 781851827 -> f8e457985
Ref ANY23-312 - update example file - update unit test Signed-off-by:Jacek Grzebyta <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/any23/repo Commit: http://git-wip-us.apache.org/repos/asf/any23/commit/af0a7e15 Tree: http://git-wip-us.apache.org/repos/asf/any23/tree/af0a7e15 Diff: http://git-wip-us.apache.org/repos/asf/any23/diff/af0a7e15 Branch: refs/heads/master Commit: af0a7e154e36564b315c253089900968d8df0a26 Parents: dfcccad Author: Jacek Grzebyta <[email protected]> Authored: Tue Oct 17 17:06:44 2017 +0100 Committer: Jacek Grzebyta <[email protected]> Committed: Tue Oct 17 17:06:44 2017 +0100 ---------------------------------------------------------------------- .../java/org/apache/any23/extractor/yaml/YAMLExtractor.java | 6 +++--- .../org/apache/any23/extractor/yaml/YAMLExtractorTest.java | 4 ++-- .../resources/org/apache/any23/extractor/yaml/test-null.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/any23/blob/af0a7e15/core/src/main/java/org/apache/any23/extractor/yaml/YAMLExtractor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/any23/extractor/yaml/YAMLExtractor.java b/core/src/main/java/org/apache/any23/extractor/yaml/YAMLExtractor.java index ab411da..dc80e0f 100644 --- a/core/src/main/java/org/apache/any23/extractor/yaml/YAMLExtractor.java +++ b/core/src/main/java/org/apache/any23/extractor/yaml/YAMLExtractor.java @@ -122,7 +122,7 @@ public class YAMLExtractor implements Extractor.ContentExtractor { Resource nodeURI = Arrays.asList(parent).isEmpty() ? YAMLExtractor.this.makeUri(file) : parent[0]; - for (String k : node.keySet()) { + node.keySet().forEach((k) -> { /* False prevents adding _<int> to the predicate. Thus the predicate pattern is: "some string" ---> ns:someString @@ -133,7 +133,7 @@ public class YAMLExtractor implements Extractor.ContentExtractor { out.writeTriple(nodeURI, (IRI) predicate, value); out.writeTriple(predicate, RDF.TYPE, RDF.PREDICATE); out.writeTriple(predicate, RDFS.LABEL, RDFUtils.literal(k)); - } + }); return nodeURI; } @@ -204,7 +204,7 @@ public class YAMLExtractor implements Extractor.ContentExtractor { uriString = uriString + "_" + Integer.toString(nodeId); } - Resource node = RDFUtils.uri(uriString); + Resource node = RDFUtils.iri(uriString); if (addId) { nodeId++; } http://git-wip-us.apache.org/repos/asf/any23/blob/af0a7e15/core/src/test/java/org/apache/any23/extractor/yaml/YAMLExtractorTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/any23/extractor/yaml/YAMLExtractorTest.java b/core/src/test/java/org/apache/any23/extractor/yaml/YAMLExtractorTest.java index fa8ae63..57588e9 100644 --- a/core/src/test/java/org/apache/any23/extractor/yaml/YAMLExtractorTest.java +++ b/core/src/test/java/org/apache/any23/extractor/yaml/YAMLExtractorTest.java @@ -89,8 +89,8 @@ public class YAMLExtractorTest extends AbstractExtractorTestCase { assertExtract("/org/apache/any23/extractor/yaml/test-null.yml"); log.debug(dumpModelToTurtle()); assertModelNotEmpty(); - RepositoryResult<Statement> docs = getStatements(null, null, RDF.NIL); - Assert.assertTrue(Iterations.asList(docs).size() == 2); + int statements = dumpAsListOfStatements().size(); + Assert.assertTrue("Found " + statements + " statements",statements == 9); } @Test http://git-wip-us.apache.org/repos/asf/any23/blob/af0a7e15/test-resources/src/test/resources/org/apache/any23/extractor/yaml/test-null.yml ---------------------------------------------------------------------- diff --git a/test-resources/src/test/resources/org/apache/any23/extractor/yaml/test-null.yml b/test-resources/src/test/resources/org/apache/any23/extractor/yaml/test-null.yml index 03cbe2b..2b16113 100644 --- a/test-resources/src/test/resources/org/apache/any23/extractor/yaml/test-null.yml +++ b/test-resources/src/test/resources/org/apache/any23/extractor/yaml/test-null.yml @@ -2,4 +2,4 @@ --- canonical: null tag: !!null - \ No newline at end of file +practice: \ No newline at end of file
