Hello, I'm beginning to study and develop a small prototype of a future
application. I'm already using TDB and could store and retrieve triple.
However I have some questions:

- It would be possible to retrieve the information and put them in a model?

Currently I do the following storage and data recovery:


public class DataBase {

  public void store(Model model) {

        Dataset dataset = TDBFactory.createDataset(Constants.DIRECTORY);
        Model tdb = dataset.getDefaultModel();
        tdb.add(model);
        tdb.close();
        dataset.close();
  }


  public String query(String sparqlQueryString) {
        Dataset dataset = TDBFactory.createDataset(Constants.DIRECTORY);
        String msg = "";
        try {
                dataset.begin(ReadWrite.READ);
                dataset.getNamedModel(Constants.NAME_APPLICATION);
                Query query = QueryFactory.create(sparqlQueryString);

                QueryExecution qexec = QueryExecutionFactory.create(query,
dataset);

                ResultSet results = qexec.execSelect();

                ResultSetFormatter.out(results);

         } catch (Exception e) {

                e.printStackTrace();

                msg = "erro";

         } finally {

                dataset.end();

                dataset.close();

         }

        return msg;
   }
}


Sincerely.


2013/9/16 Andy Seaborne <[email protected]>

> On 16/09/13 15:21, Márcio Vinicius wrote:
>
>> Andy, in relation to TDB have some application client to manage the files
>> for storing triples, such as phpMyAdmin or pgAdmin.
>>
>
> There's nothing of that kind in Jena itself - it would be nice for Fuseki
>
> See JENA-420.
>
>  Cause I'm developing a large application and I think I need some
>> application that assist me file management has persisted.
>>
>> thank you.
>>
>>
>> 2013/9/16 Márcio Vinicius <[email protected]>
>>
>>  Andy, you cleared my doubts. I am developing an application that requires
>>> a relational database (Postgres), because I register more than 60,000
>>> objects, as well as users and etc..
>>>
>>> Logo must use SDB. Thank you.
>>>
>>>
>>> 2013/9/15 Andy Seaborne <[email protected]>
>>>
>>>  On 13/09/13 21:18, Márcio Vinicius wrote:
>>>>
>>>>  Andy,
>>>>>
>>>>>            In Jena documentation, all the examples using the TDB does
>>>>> not
>>>>> use
>>>>> a relational database (MySQL or Postgres), is to use a bank or
>>>>> component
>>>>> is
>>>>> only TDB file?
>>>>>
>>>>>
>>>> (sorry - I don't understand the last part of that sentence)
>>>>
>>>>
>>>>
>>>>              It is recommended to use SDB on new projects? Because I
>>>>> read
>>>>> that
>>>>> it was not recommended.
>>>>>
>>>>>
>>>> We do not recommend using SDB for new projects.  See [1]. There are
>>>> cases
>>>> where SDB is necessary, typically where storing in an SQL databases is a
>>>> mandatory requirement of a project.  However, SDB does not scale as
>>>> well as
>>>> TDB and is slower.  It does not get the same level of testing as other
>>>> components - the project relies on user reports and we do not have
>>>> complete
>>>> coverage any more.
>>>>
>>>>          Andy
>>>>
>>>> [1] The wording we use visible at:
>>>>    http://jena.staging.apache.****org/documentation/sdb/<http://**
>>>> jena.staging.apache.org/**documentation/sdb/<http://jena.staging.apache.org/documentation/sdb/>
>>>> >
>>>>
>>>> and will be published to the main site in the next release.
>>>>
>>>>
>>>>  thank.
>>>>>
>>>>>
>>>>> 2013/9/3 Andy Seaborne <[email protected]>
>>>>>
>>>>>   On 03/09/13 19:35, Márcio Vinicius wrote:
>>>>>
>>>>>>
>>>>>>   Dear, I have studied the Jena for some time and did some test
>>>>>>
>>>>>>> prototypes.
>>>>>>> In recent studies found that the documentation indicates the TDB
>>>>>>> component
>>>>>>> for development of new applications, but all prototypes that had made
>>>>>>> was
>>>>>>> based on SDB.
>>>>>>>
>>>>>>> Example of connection:
>>>>>>>
>>>>>>>          public Store getStore() {
>>>>>>>
>>>>>>> StoreDesc storeDesc = new StoreDesc(LayoutType.****
>>>>>>> LayoutTripleNodesHash,
>>>>>>>     DatabaseType.PostgreSQL);
>>>>>>> JDBC.loadDriverPGSQL();
>>>>>>>
>>>>>>> SDBConnection conn = new SDBConnection(Constants.DB_******URL,
>>>>>>>
>>>>>>>
>>>>>>>     Constants.DB_USER,
>>>>>>> Constants.DB_PASSWD);
>>>>>>>
>>>>>>> Store store = SDBFactory.connectStore(conn, storeDesc);
>>>>>>>     try {
>>>>>>> if (!StoreUtils.isFormatted(******store)) {
>>>>>>> store.getTableFormatter().******create();
>>>>>>>
>>>>>>>
>>>>>>>     }
>>>>>>> } catch (SQLException e) {
>>>>>>> e.printStackTrace();
>>>>>>>     }
>>>>>>> return store;
>>>>>>> }
>>>>>>>
>>>>>>> How do I use the component TDB?
>>>>>>>
>>>>>>>
>>>>>>>  Hi there,
>>>>>>
>>>>>> See
>>>>>>
>>>>>> http://jena.apache.org/******documentation/tdb/<http://jena.apache.org/****documentation/tdb/>
>>>>>> <http://**jena.apache.org/****documentation/tdb/<http://jena.apache.org/**documentation/tdb/>
>>>>>> >
>>>>>> <http://**jena.apache.org/**documentation/**tdb/<http://jena.apache.org/documentation/**tdb/>
>>>>>> <http://**jena.apache.org/documentation/**tdb/<http://jena.apache.org/documentation/tdb/>
>>>>>> >
>>>>>>
>>>>>>>
>>>>>>>
>>>>>> The pattern is similar:
>>>>>>
>>>>>> Dataset ds = TDBFactory.createDatatset(******directory) ;
>>>>>>
>>>>>>
>>>>>>
>>>>>> and use the dataset as normal.
>>>>>>
>>>>>> No formatting is necessary.
>>>>>>
>>>>>>           Andy
>>>>>>
>>>>>>
>>>>>>   att
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> --
>>> *Márcio Vinícius Oliveira Sena*
>>>
>>> Bacharelando em Sistemas de Informação -  UFG
>>> Desenvolvedor Front-end no Laboratório de Tecnologia e Mídias
>>> Educacionais
>>> - Labtime/UFG
>>> Gerente de Projeto e Desenvolvedor Front-end
>>> @marciosena17 
>>> <http://twitter.com/**marciosena17<http://twitter.com/marciosena17>
>>> >
>>>
>>>
>>>
>>
>>
>


-- 
*Márcio Vinícius Oliveira Sena*
Bacharelando em Sistemas de Informação -  UFG
Desenvolvedor Front-end no Laboratório de Tecnologia e Mídias Educacionais
- Labtime/UFG
Gerente de Projeto e Desenvolvedor Front-end
@marciosena17 <http://twitter.com/marciosena17>

Reply via email to