You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by jena melina <je...@gmail.com> on 2018/06/21 20:53:16 UTC

Fuseki / Java

hello ,

I'm have  a java program that manipulate my  ontology ( create activity ,
tag , user ...)




public TEST() {
    onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
    OntDocumentManager manager = onto.getDocumentManager();


    manager.addAltEntry("https://www.w3.org/ns/test", "ontologies/test.owl")
;
    manager.addAltEntry("https://www.w3.org/ns/test2",
"ontologies/test2.owl");

    this.synchronize();


}



For example to create Activity I use this method :

public Resource createEntity(String uri) throws
AlreadyExistingRdfResourceException {

    Resource res = onto.getIndividual(uri);
    if (res != null) throw new AlreadyExistingRdfResourceException(uri);
    res = onto.createResource(uri);
    return res;
}



Now I need to use Fuseki server to save all modification that I do , but I
don’t want to do many modification on my code , so I don’t know if I can
found help here ..

I know how to connect to Fuseki server , but I don’t found how I can save
the owl into fuseki server , and how I can request   or modify my ontology
using (my code + Fuseki server ).


thanks for your help

Re: Fuseki / Java

Posted by mellassi khouloud <kh...@gmail.com>.
Hello ,

I Don't use any TDB , but i want to know what's the difference between
using TDB or not ?
what's the best solution .
thanks



2018-06-23 10:49 GMT+02:00 Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de>:

> 1. What is the backend of your Fuseki server?
>
> 2. You can use RDFConnection [1] to "communicate" with the Fuseki if
> there is no underlying TDB
>
>
> [1] https://jena.apache.org/documentation/rdfconnection/
>
>
> On 22.06.2018 10:20, jena melina wrote:
> > thanks for your answer ,
> > but i don't understand what you want to explain ... could you please
> > explain to me what I should I do ?
> >
> > 2018-06-22 7:37 GMT+02:00 Lorenz Buehmann <
> > buehmann@informatik.uni-leipzig.de>:
> >
> >> To extend my answer, for SPARQL I'd prefer the RDFConnection way [1]
> >>
> >>
> >> [1] https://jena.apache.org/documentation/rdfconnection/
> >>
> >>
> >> On 22.06.2018 07:35, Lorenz Buehmann wrote:
> >>> Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
> >>> you can use the code from the TDB examples with the corresponding TDB
> >>> location.
> >>>
> >>> If enabled, you could also use SPARQL Update protocol, i.e. write
> >>> queries instead of Java code.
> >>>
> >>> The documentation:
> >>> https://jena.apache.org/documentation/serving_data/#use-from-java
> >>>
> >>>
> >>> On 21.06.2018 22:53, jena melina wrote:
> >>>> hello ,
> >>>>
> >>>> I'm have  a java program that manipulate my  ontology ( create
> activity
> >> ,
> >>>> tag , user ...)
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> public TEST() {
> >>>>     onto = ModelFactory.*createOntologyModel*(
> OntModelSpec.*OWL_MEM*);
> >>>>     OntDocumentManager manager = onto.getDocumentManager();
> >>>>
> >>>>
> >>>>     manager.addAltEntry("https://www.w3.org/ns/test",
> >> "ontologies/test.owl")
> >>>> ;
> >>>>     manager.addAltEntry("https://www.w3.org/ns/test2",
> >>>> "ontologies/test2.owl");
> >>>>
> >>>>     this.synchronize();
> >>>>
> >>>>
> >>>> }
> >>>>
> >>>>
> >>>>
> >>>> For example to create Activity I use this method :
> >>>>
> >>>> public Resource createEntity(String uri) throws
> >>>> AlreadyExistingRdfResourceException {
> >>>>
> >>>>     Resource res = onto.getIndividual(uri);
> >>>>     if (res != null) throw new AlreadyExistingRdfResourceExce
> >> ption(uri);
> >>>>     res = onto.createResource(uri);
> >>>>     return res;
> >>>> }
> >>>>
> >>>>
> >>>>
> >>>> Now I need to use Fuseki server to save all modification that I do ,
> >> but I
> >>>> don’t want to do many modification on my code , so I don’t know if I
> can
> >>>> found help here ..
> >>>>
> >>>> I know how to connect to Fuseki server , but I don’t found how I can
> >> save
> >>>> the owl into fuseki server , and how I can request   or modify my
> >> ontology
> >>>> using (my code + Fuseki server ).
> >>>>
> >>>>
> >>>> thanks for your help
> >>>>
> >>
>
>

Re: Fuseki / Java

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
1. What is the backend of your Fuseki server?

2. You can use RDFConnection [1] to "communicate" with the Fuseki if
there is no underlying TDB


[1] https://jena.apache.org/documentation/rdfconnection/


On 22.06.2018 10:20, jena melina wrote:
> thanks for your answer ,
> but i don't understand what you want to explain ... could you please
> explain to me what I should I do ?
>
> 2018-06-22 7:37 GMT+02:00 Lorenz Buehmann <
> buehmann@informatik.uni-leipzig.de>:
>
>> To extend my answer, for SPARQL I'd prefer the RDFConnection way [1]
>>
>>
>> [1] https://jena.apache.org/documentation/rdfconnection/
>>
>>
>> On 22.06.2018 07:35, Lorenz Buehmann wrote:
>>> Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
>>> you can use the code from the TDB examples with the corresponding TDB
>>> location.
>>>
>>> If enabled, you could also use SPARQL Update protocol, i.e. write
>>> queries instead of Java code.
>>>
>>> The documentation:
>>> https://jena.apache.org/documentation/serving_data/#use-from-java
>>>
>>>
>>> On 21.06.2018 22:53, jena melina wrote:
>>>> hello ,
>>>>
>>>> I'm have  a java program that manipulate my  ontology ( create activity
>> ,
>>>> tag , user ...)
>>>>
>>>>
>>>>
>>>>
>>>> public TEST() {
>>>>     onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
>>>>     OntDocumentManager manager = onto.getDocumentManager();
>>>>
>>>>
>>>>     manager.addAltEntry("https://www.w3.org/ns/test",
>> "ontologies/test.owl")
>>>> ;
>>>>     manager.addAltEntry("https://www.w3.org/ns/test2",
>>>> "ontologies/test2.owl");
>>>>
>>>>     this.synchronize();
>>>>
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>> For example to create Activity I use this method :
>>>>
>>>> public Resource createEntity(String uri) throws
>>>> AlreadyExistingRdfResourceException {
>>>>
>>>>     Resource res = onto.getIndividual(uri);
>>>>     if (res != null) throw new AlreadyExistingRdfResourceExce
>> ption(uri);
>>>>     res = onto.createResource(uri);
>>>>     return res;
>>>> }
>>>>
>>>>
>>>>
>>>> Now I need to use Fuseki server to save all modification that I do ,
>> but I
>>>> don’t want to do many modification on my code , so I don’t know if I can
>>>> found help here ..
>>>>
>>>> I know how to connect to Fuseki server , but I don’t found how I can
>> save
>>>> the owl into fuseki server , and how I can request   or modify my
>> ontology
>>>> using (my code + Fuseki server ).
>>>>
>>>>
>>>> thanks for your help
>>>>
>>


Re: Fuseki / Java

Posted by jena melina <je...@gmail.com>.
thanks for your answer ,
but i don't understand what you want to explain ... could you please
explain to me what I should I do ?

2018-06-22 7:37 GMT+02:00 Lorenz Buehmann <
buehmann@informatik.uni-leipzig.de>:

> To extend my answer, for SPARQL I'd prefer the RDFConnection way [1]
>
>
> [1] https://jena.apache.org/documentation/rdfconnection/
>
>
> On 22.06.2018 07:35, Lorenz Buehmann wrote:
> > Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
> > you can use the code from the TDB examples with the corresponding TDB
> > location.
> >
> > If enabled, you could also use SPARQL Update protocol, i.e. write
> > queries instead of Java code.
> >
> > The documentation:
> > https://jena.apache.org/documentation/serving_data/#use-from-java
> >
> >
> > On 21.06.2018 22:53, jena melina wrote:
> >> hello ,
> >>
> >> I'm have  a java program that manipulate my  ontology ( create activity
> ,
> >> tag , user ...)
> >>
> >>
> >>
> >>
> >> public TEST() {
> >>     onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
> >>     OntDocumentManager manager = onto.getDocumentManager();
> >>
> >>
> >>     manager.addAltEntry("https://www.w3.org/ns/test",
> "ontologies/test.owl")
> >> ;
> >>     manager.addAltEntry("https://www.w3.org/ns/test2",
> >> "ontologies/test2.owl");
> >>
> >>     this.synchronize();
> >>
> >>
> >> }
> >>
> >>
> >>
> >> For example to create Activity I use this method :
> >>
> >> public Resource createEntity(String uri) throws
> >> AlreadyExistingRdfResourceException {
> >>
> >>     Resource res = onto.getIndividual(uri);
> >>     if (res != null) throw new AlreadyExistingRdfResourceExce
> ption(uri);
> >>     res = onto.createResource(uri);
> >>     return res;
> >> }
> >>
> >>
> >>
> >> Now I need to use Fuseki server to save all modification that I do ,
> but I
> >> don’t want to do many modification on my code , so I don’t know if I can
> >> found help here ..
> >>
> >> I know how to connect to Fuseki server , but I don’t found how I can
> save
> >> the owl into fuseki server , and how I can request   or modify my
> ontology
> >> using (my code + Fuseki server ).
> >>
> >>
> >> thanks for your help
> >>
>
>

Re: Fuseki / Java

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
To extend my answer, for SPARQL I'd prefer the RDFConnection way [1]


[1] https://jena.apache.org/documentation/rdfconnection/


On 22.06.2018 07:35, Lorenz Buehmann wrote:
> Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
> you can use the code from the TDB examples with the corresponding TDB
> location.
>
> If enabled, you could also use SPARQL Update protocol, i.e. write
> queries instead of Java code.
>
> The documentation:
> https://jena.apache.org/documentation/serving_data/#use-from-java
>
>
> On 21.06.2018 22:53, jena melina wrote:
>> hello ,
>>
>> I'm have  a java program that manipulate my  ontology ( create activity ,
>> tag , user ...)
>>
>>
>>
>>
>> public TEST() {
>>     onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
>>     OntDocumentManager manager = onto.getDocumentManager();
>>
>>
>>     manager.addAltEntry("https://www.w3.org/ns/test", "ontologies/test.owl")
>> ;
>>     manager.addAltEntry("https://www.w3.org/ns/test2",
>> "ontologies/test2.owl");
>>
>>     this.synchronize();
>>
>>
>> }
>>
>>
>>
>> For example to create Activity I use this method :
>>
>> public Resource createEntity(String uri) throws
>> AlreadyExistingRdfResourceException {
>>
>>     Resource res = onto.getIndividual(uri);
>>     if (res != null) throw new AlreadyExistingRdfResourceException(uri);
>>     res = onto.createResource(uri);
>>     return res;
>> }
>>
>>
>>
>> Now I need to use Fuseki server to save all modification that I do , but I
>> don’t want to do many modification on my code , so I don’t know if I can
>> found help here ..
>>
>> I know how to connect to Fuseki server , but I don’t found how I can save
>> the owl into fuseki server , and how I can request   or modify my ontology
>> using (my code + Fuseki server ).
>>
>>
>> thanks for your help
>>


Re: Fuseki / Java

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Fuseki is an HTTP SPARQL server - but what is the backend? If it's TDB,
you can use the code from the TDB examples with the corresponding TDB
location.

If enabled, you could also use SPARQL Update protocol, i.e. write
queries instead of Java code.

The documentation:
https://jena.apache.org/documentation/serving_data/#use-from-java


On 21.06.2018 22:53, jena melina wrote:
> hello ,
>
> I'm have  a java program that manipulate my  ontology ( create activity ,
> tag , user ...)
>
>
>
>
> public TEST() {
>     onto = ModelFactory.*createOntologyModel*(OntModelSpec.*OWL_MEM*);
>     OntDocumentManager manager = onto.getDocumentManager();
>
>
>     manager.addAltEntry("https://www.w3.org/ns/test", "ontologies/test.owl")
> ;
>     manager.addAltEntry("https://www.w3.org/ns/test2",
> "ontologies/test2.owl");
>
>     this.synchronize();
>
>
> }
>
>
>
> For example to create Activity I use this method :
>
> public Resource createEntity(String uri) throws
> AlreadyExistingRdfResourceException {
>
>     Resource res = onto.getIndividual(uri);
>     if (res != null) throw new AlreadyExistingRdfResourceException(uri);
>     res = onto.createResource(uri);
>     return res;
> }
>
>
>
> Now I need to use Fuseki server to save all modification that I do , but I
> don’t want to do many modification on my code , so I don’t know if I can
> found help here ..
>
> I know how to connect to Fuseki server , but I don’t found how I can save
> the owl into fuseki server , and how I can request   or modify my ontology
> using (my code + Fuseki server ).
>
>
> thanks for your help
>