Package org.apache.marmotta.commons.sesame.facading.foaf.model

Examples of org.apache.marmotta.commons.sesame.facading.foaf.model.Person


            Facading facading = FacadingFactory.createFacading(connectionRDF);

            // test individual resource
            URI u_hans_meier = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            URI u_anna_schmidt = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/anna_schmidt");
            Person hans_meier = facading.createFacade(u_hans_meier,Person.class);

            Assert.assertEquals("Hans Meier",hans_meier.getName());
            Assert.assertEquals(2,hans_meier.getFriends().size());
            Assert.assertThat(hans_meier.getOnlineAccounts(),
                    CoreMatchers.<OnlineAccount> hasItem(hasProperty("accountName", is("Example"))));

            Assert.assertThat(hans_meier.getFriends(), allOf(
                    CoreMatchers.<Person> hasItem(hasProperty("name", is("Anna Schmidt"))),
                    CoreMatchers.<Person> hasItem(hasProperty("name", is("Sepp Huber")))
                    ));

            // test collection
View Full Code Here


            Facading facading = FacadingFactory.createFacading(connectionRDF);

            // test individual resource
            URI u_hans_meier = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            Person hans_meier = facading.createFacade(u_hans_meier,Person.class);

            Assert.assertNull(hans_meier.getNick());

            // set nick name and check if it is now set
            hans_meier.setNick("hansi");
            Assert.assertNotNull(hans_meier.getNick());
            Assert.assertEquals("hansi",hans_meier.getNick());

            // check in triple store if the triple is there
            URI p_foaf_nick = connectionRDF.getValueFactory().createURI(Namespaces.NS_FOAF + "nick");
            RepositoryResult<Statement> nicknames = connectionRDF.getStatements(u_hans_meier,p_foaf_nick,null,true);
            Assert.assertTrue(nicknames.hasNext());
            Assert.assertEquals("hansi",nicknames.next().getObject().stringValue());
            nicknames.close();

            // test creating a completely new resource
            URI u_fritz_fischer = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/fritz_fischer");
            Person fritz_fischer = facading.createFacade(u_fritz_fischer,Person.class);
            fritz_fischer.setName("Fritz Fischer");

            Assert.assertEquals("Fritz Fischer", fritz_fischer.getName());

            // test if it is now there
            URI p_foaf_name = connectionRDF.getValueFactory().createURI(Namespaces.NS_FOAF + "name");
            RepositoryResult<Statement> names = connectionRDF.getStatements(u_fritz_fischer,p_foaf_name,null,true);
            Assert.assertTrue(names.hasNext());
View Full Code Here

        final RepositoryConnection connection = repositoryRDF.getConnection();
        try {
            final Facading facading = FacadingFactory.createFacading(connection);

            URI u_hans_meier = connection.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            Person hans_meier = facading.createFacade(u_hans_meier, Person.class);
            Assume.assumeThat("Could not load test-person", hans_meier, notNullValue(Person.class));

            for (OnlineAccount account : hans_meier.getOnlineAccounts()) {
                Assert.assertNotNull(account);
                final Resource accountRSC = account.getDelegate();
                Assert.assertNotNull(accountRSC);

                final OnlineAccount oa = facading.createFacade(accountRSC, OnlineAccount.class);
View Full Code Here

        final RepositoryConnection connection = repositoryRDF.getConnection();
        try {
            final Facading facading = FacadingFactory.createFacading(connection);

            URI p = connection.getValueFactory().createURI("http://localhost/person");
            Person person = facading.createFacade(p, Person.class);

            URI a = connection.getValueFactory().createURI("http://localhost/account");
            OnlineAccount account = facading.createFacade(a, OnlineAccount.class);

            account.setHolder(person);

            connection.commit();

            Assert.assertThat(person.getOnlineAccounts(), CoreMatchers.hasItem(account));

        } finally {
            connection.close();
        }
    }
View Full Code Here

            Facading facading = FacadingFactory.createFacading(connectionRDF);

            // test individual resource
            URI u_hans_meier = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            URI u_anna_schmidt = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/anna_schmidt");
            Person hans_meier = facading.createFacade(u_hans_meier,Person.class);

            Assert.assertEquals("Hans Meier",hans_meier.getName());
            Assert.assertEquals(2,hans_meier.getFriends().size());
            Assert.assertThat(hans_meier.getOnlineAccounts(),
                    CoreMatchers.<OnlineAccount> hasItem(hasProperty("accountName", is("Example"))));

            Assert.assertThat(hans_meier.getFriends(), allOf(
                    CoreMatchers.<Person> hasItem(hasProperty("name", is("Anna Schmidt"))),
                    CoreMatchers.<Person> hasItem(hasProperty("name", is("Sepp Huber")))
                    ));

            // test collection
View Full Code Here

            Facading facading = FacadingFactory.createFacading(connectionRDF);

            // test individual resource
            URI u_hans_meier = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            Person hans_meier = facading.createFacade(u_hans_meier,Person.class);

            Assert.assertNull(hans_meier.getNick());

            // set nick name and check if it is now set
            hans_meier.setNick("hansi");
            Assert.assertNotNull(hans_meier.getNick());
            Assert.assertEquals("hansi",hans_meier.getNick());

            // check in triple store if the triple is there
            URI p_foaf_nick = connectionRDF.getValueFactory().createURI(Namespaces.NS_FOAF + "nick");
            RepositoryResult<Statement> nicknames = connectionRDF.getStatements(u_hans_meier,p_foaf_nick,null,true);
            Assert.assertTrue(nicknames.hasNext());
            Assert.assertEquals("hansi",nicknames.next().getObject().stringValue());
            nicknames.close();

            // test creating a completely new resource
            URI u_fritz_fischer = connectionRDF.getValueFactory().createURI("http://localhost:8080/LMF/resource/fritz_fischer");
            Person fritz_fischer = facading.createFacade(u_fritz_fischer,Person.class);
            fritz_fischer.setName("Fritz Fischer");

            Assert.assertEquals("Fritz Fischer", fritz_fischer.getName());

            // test if it is now there
            URI p_foaf_name = connectionRDF.getValueFactory().createURI(Namespaces.NS_FOAF + "name");
            RepositoryResult<Statement> names = connectionRDF.getStatements(u_fritz_fischer,p_foaf_name,null,true);
            Assert.assertTrue(names.hasNext());
View Full Code Here

        final RepositoryConnection connection = repositoryRDF.getConnection();
        try {
            final Facading facading = FacadingFactory.createFacading(connection);

            URI u_hans_meier = connection.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier");
            Person hans_meier = facading.createFacade(u_hans_meier, Person.class);
            Assume.assumeThat("Could not load test-person", hans_meier, notNullValue(Person.class));

            for (OnlineAccount account : hans_meier.getOnlineAccounts()) {
                Assert.assertNotNull(account);
                final Resource accountRSC = account.getDelegate();
                Assert.assertNotNull(accountRSC);

                final OnlineAccount oa = facading.createFacade(accountRSC, OnlineAccount.class);
View Full Code Here

        final RepositoryConnection connection = repositoryRDF.getConnection();
        try {
            final Facading facading = FacadingFactory.createFacading(connection);

            URI p = connection.getValueFactory().createURI("http://localhost/person");
            Person person = facading.createFacade(p, Person.class);

            URI a = connection.getValueFactory().createURI("http://localhost/account");
            OnlineAccount account = facading.createFacade(a, OnlineAccount.class);

            account.setHolder(person);

            connection.commit();

            Assert.assertThat(person.getOnlineAccounts(), CoreMatchers.hasItem(account));

        } finally {
            connection.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.marmotta.commons.sesame.facading.foaf.model.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.