use of org.apache.jena.assembler.assemblers.ContentAssembler in project jena by apache.
the class TestContentAssembler method testContent.
public void testContent() {
Assembler a = new ContentAssembler();
Content c = (Content) a.open(resourceInModel("x rdf:type ja:Content"));
assertNotNull(c);
Model m = ModelFactory.createDefaultModel();
c.fill(m);
assertEquals(0, m.size());
}
use of org.apache.jena.assembler.assemblers.ContentAssembler in project jena by apache.
the class TestContentAssembler method testMultipleLiteralsWorks.
public void testMultipleLiteralsWorks() {
Assembler a = new ContentAssembler();
String A = "<eh:/A> a <eh:/Type>.".replaceAll(" ", "\\\\s");
String B = "<eh:/Type> a rdfs:Class.".replaceAll(" ", "\\\\s");
Resource root = resourceInModel("x rdf:type ja:Content; x rdf:type ja:LiteralContent; x ja:literalContent '" + A + "'; x ja:literalContent '" + B + "'");
Content C = (Content) a.open(root);
assertIsoModels(model("Type rdf:type rdfs:Class; A rdf:type Type"), C.fill(model("")));
}
use of org.apache.jena.assembler.assemblers.ContentAssembler in project jena by apache.
the class TestContentAssembler method testSingleContentQuotation.
public void testSingleContentQuotation() {
Assembler a = new ContentAssembler();
Resource root = resourceInModel("c rdf:type ja:Content; c rdf:type ja:QuotedContent; c ja:quotedContent x; x P A; x Q B");
Content c = (Content) a.open(root);
assertIsoModels(model("x P A; x Q B"), c.fill(model("")));
}
use of org.apache.jena.assembler.assemblers.ContentAssembler in project jena by apache.
the class TestContentAssembler method testRDFXMLContent.
public void testRDFXMLContent() {
Assembler a = new ContentAssembler();
String Stuff = "<owl:Class></owl:Class>".replaceAll(" ", "\\\\s");
Resource root = resourceInModel("x rdf:type ja:Content; x rdf:type ja:LiteralContent; x ja:literalContent '" + Stuff + "'; x ja:contentEncoding 'RDF/XML'");
Content c = (Content) a.open(root);
assertIsoModels(model("_x rdf:type owl:Class"), c.fill(model("")));
}
use of org.apache.jena.assembler.assemblers.ContentAssembler in project jena by apache.
the class TestContentAssembler method testContentTrapsBadObjects.
private void testContentTrapsBadObjects(String property, String value) {
Assembler a = new ContentAssembler();
Resource root = resourceInModel("x rdf:type ja:Content; x <property> <value>".replaceAll("<property>", property).replaceAll("<value>", value));
try {
a.open(root);
fail("should trap bad content resource");
} catch (BadObjectException e) {
assertEquals(resource("x"), e.getRoot());
assertEquals(rdfNode(empty, value), e.getObject());
}
}
Aggregations