### Question:
RdfModelConverter { public void addFacts(KnowledgeBase knowledgeBase, Model model) { model.stream().forEach((statement) -> { knowledgeBase.addStatement(rdfStatementToFact(statement)); }); } RdfModelConverter();  RdfModelConverter(boolean skolemize, String triplePredicateName); Set<Fact> rdfModelToFacts(final Model model); void addAll(KnowledgeBase knowledgeBase, Model model); void addFacts(KnowledgeBase knowledgeBase, Model model); void addPrefixes(KnowledgeBase knowledgeBase, Model model); static final String RDF_TRIPLE_PREDICATE_NAME; }### Answer:
@Test public void addFactsCustomTriplePredicate_succeeds() throws RDFParseException, RDFHandlerException, IOException, PrefixDeclarationException { RdfModelConverter rdfModelConverter = new RdfModelConverter(true, "mytriple"); Model model = RdfTestUtils.parseFile(new File(RdfTestUtils.INPUT_FOLDER + "test-turtle.ttl"), RDFFormat.TURTLE); KnowledgeBase knowledgeBase = new KnowledgeBase(); Predicate predicate = Expressions.makePredicate("mytriple", 3); Term terma = Expressions.makeAbstractConstant("http: Term termb = Expressions.makeAbstractConstant("http: Term termc = Expressions.makeAbstractConstant("http: Fact fact = Expressions.makeFact(predicate, terma, termb, termc); rdfModelConverter.addFacts(knowledgeBase, model); assertEquals(Arrays.asList(fact), knowledgeBase.getFacts()); }
@Test public void addFactsNoTriplePredicate_succeeds() throws RDFParseException, RDFHandlerException, IOException, PrefixDeclarationException { RdfModelConverter rdfModelConverter = new RdfModelConverter(true, null); Model model = RdfTestUtils.parseFile(new File(RdfTestUtils.INPUT_FOLDER + "test-turtle.ttl"), RDFFormat.TURTLE); KnowledgeBase knowledgeBase = new KnowledgeBase(); Predicate predicate = Expressions.makePredicate("http: Term terma = Expressions.makeAbstractConstant("http: Term termc = Expressions.makeAbstractConstant("http: Fact fact = Expressions.makeFact(predicate, terma, termc); rdfModelConverter.addFacts(knowledgeBase, model); assertEquals(Arrays.asList(fact), knowledgeBase.getFacts()); }
@Test public void addFactsNoTriplePredicateType_succeeds() throws RDFParseException, RDFHandlerException, IOException, PrefixDeclarationException { RdfModelConverter rdfModelConverter = new RdfModelConverter(true, null); Model model = RdfTestUtils.parseFile(new File(RdfTestUtils.INPUT_FOLDER + "test-turtle-type.ttl"), RDFFormat.TURTLE); KnowledgeBase knowledgeBase = new KnowledgeBase(); Predicate predicate = Expressions.makePredicate("http: Term terma = Expressions.makeAbstractConstant("http: Fact fact = Expressions.makeFact(predicate, terma); rdfModelConverter.addFacts(knowledgeBase, model); assertEquals(Arrays.asList(fact), knowledgeBase.getFacts()); }
@Test public void addFactsNoTriplePredicateTypeWeird_succeeds() throws RDFParseException, RDFHandlerException, IOException, PrefixDeclarationException { RdfModelConverter rdfModelConverter = new RdfModelConverter(true, null); Model model = RdfTestUtils.parseFile(new File(RdfTestUtils.INPUT_FOLDER + "test-turtle-type-weird.ttl"), RDFFormat.TURTLE); KnowledgeBase knowledgeBase = new KnowledgeBase(); Predicate predicate = Expressions.makePredicate(PrefixDeclarationRegistry.RDF_TYPE, 2); Term terma = Expressions.makeAbstractConstant("http: Term termc = Expressions.makeLanguageStringConstant("test", "de"); Fact fact = Expressions.makeFact(predicate, terma, termc); rdfModelConverter.addFacts(knowledgeBase, model); assertEquals(Arrays.asList(fact), knowledgeBase.getFacts()); }