public MiniRepository(STMT... stmts) { this(stmts.length); add(stmts); }
public void addStatements(STMT... stmts) { this.repository.add(stmts); }
@Override public void update(Collection<STMT> removedStatements, Collection<STMT> addedStatements) { if (removedStatements != null) { repository.removeStatements(removedStatements); } if (addedStatements != null) { repository.add(addedStatements.toArray(new STMT[addedStatements.size()])); } }
@Before public void setUp() { List<STMT> stmts = new ArrayList<STMT>(); stmts.add(new STMT(RDF.type, RDF.type, RDF.Property)); stmts.add(new STMT(RDF.type, RDFS.label, new LIT("type"))); stmts.add(new STMT(RDF.type, RDFS.label, new LIT("tyyppi", new Locale("fi")))); stmts.add(new STMT(RDFS.Resource, RDF.type, RDFS.Class)); stmts.add(new STMT(RDFS.Resource, RDFS.label, new LIT("Resource"))); repository.add(stmts.toArray(new STMT[stmts.size()])); }
@Test(expected = IllegalArgumentException.class) public void Error() { MiniRepository repository = new MiniRepository(); UID id = new UID("http://example2.com/abc"); UID type = new UID(TEST.NS, "IdMappingTest"); repository.add(new STMT(id, RDF.type, type)); Session session = SessionUtil.openSession(repository, IdMappingTest.class); session.get(IdMappingTest.class, id); }
repository.add( new STMT(_project, _owner, _person), new STMT(_project, _deadline, new LIT(DEADLINE.toString(), XSD.date)),
@Test public void ClassReference() { MiniRepository repository = new MiniRepository(); repository.add( new STMT(new UID(TEST.NS, "domainType"), RDF.type, new UID(TEST.NS, "DomainType")) ); Session session = SessionUtil.openSession(repository, DomainType.class); Command command = new Command(); assertNull(command.domainType); session.autowire(command); assertNotNull(command.domainType); assertNotNull(command.domainType.parametrizedClass); assertTrue(DomainType.class.isAssignableFrom(command.domainType.parametrizedClass)); }
@Before public void setUp() { repository = new MiniRepository(); configuration = new DefaultConfiguration(TEST.NS, Project.class, Person.class); sessionFactory = new SessionFactoryImpl(); sessionFactory.setRepository(repository); sessionFactory.setConfiguration(configuration); sessionFactory.initialize(); repository.add( new STMT(_project, RDF.type, new UID(TEST.NS, "Project")), new STMT(_project, _name, new LIT("TestProject")), new STMT(_project, _created, new LIT(CREATED.toString(), XSD.date)), new STMT(_person, RDF.type, new UID(TEST.NS, "Person")), new STMT(_person, _name, new LIT("Foo Bar")) ); session = sessionFactory.openSession(); }