Default RDF/XML writer changed between 2.11.0 and 3.0.1?

2016-07-21 Thread Martynas Jusevičius
Hey,

I noticed that after upgrade from 2.11.0 to 3.0.1 the RDF/XML output
changed: element name is used instead of rdf:Description + rdf:type,
rdf:nodeID attribute is gone etc (output below).

The model is written the same way, like this:

  model.write(baos, RDFLanguages.RDFXML.getName(), null);

Am I right? How do I get the old behavior, i.e. write the plain RDF/XML format?

I think I have traced 3.0.1 behaviour to
RDFWriterRegistry.defaultSerialization(Lang lang) which chooses
RDFFormat(Lang.RDFXML, ABBREV).

2.11.0

http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 xmlns:j.0="http://purl.org/dc/terms/;
 xmlns:j.1="http://www.w3.org/2011/http#;>
   
  http://www.w3.org/2001/XMLSchema#string;>Agent not
authorized
  http://www.w3.org/2011/http#Response;>
  http://www.w3.org/2001/XMLSchema#string;>Forbidden
  http://www.w3.org/2011/http-statusCodes#Forbidden;>
  http://www.w3.org/2001/XMLSchema#long;>403
   


3.0.1

 http://www.w3.org/1999/02/22-rdf-syntax-ns#;
  xmlns:j.0="http://purl.org/dc/terms/;
  xmlns:j.1="http://www.w3.org/2011/http#;>

   Agent not authorized
   http://www.w3.org/2011/http-statusCodes#Forbidden;>
   Forbidden
   http://www.w3.org/2001/XMLSchema#long;>403

 


Martynas
atomgraph.com


Re: Concurrent access to a shared (Ont)Model

2016-07-21 Thread Martynas Jusevičius
Thanks Dave. Does the following code look reasonable?


OntModel ontModel =
OntDocumentManager.getInstance().getOntology(ontologyURI,
ontModelSpec);
ontModel.enterCriticalSection(Lock.READ);
try
{
OntModel clonedModel =
ModelFactory.createOntologyModel(ontModelSpec);
clonedModel.add(ontModel);
return clonedModel;
}
finally
{
ontModel.leaveCriticalSection();
}

On Wed, Jul 20, 2016 at 10:46 AM, Dave Reynolds
 wrote:
> So that's the reasoner in which case you need to lock the OntModel.
>
> Dave
>
>
> On 19/07/16 17:04, Martynas Jusevičius wrote:
>>
>> Hey Andy,
>>
>> I am not sure yet what is it that I need to lock - is it the OntModel, or
>> the OntDocumentManager instance, or maybe both.
>>
>> But here are 2 actual exceptions:
>>
>> java.util.ConcurrentModificationException
>> at
>>
>> com.hp.hpl.jena.reasoner.rulesys.impl.LPTopGoalIterator.checkCME(LPTopGoalIterator.java:247)
>> at
>>
>> com.hp.hpl.jena.reasoner.rulesys.impl.LPTopGoalIterator.hasNext(LPTopGoalIterator.java:221)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> at
>> com.hp.hpl.jena.util.iterator.Map1Iterator.hasNext(Map1Iterator.java:48)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>> com.hp.hpl.jena.util.iterator.Map1Iterator.hasNext(Map1Iterator.java:48)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> at
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> at
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> at
>>
>> org.graphity.client.filter.response.ConstructorBase.construct(ConstructorBase.java:130)
>>
>>
>>
>>
>> java.util.ConcurrentModificationException: Due to closed iterator
>>
>> com.hp.hpl.jena.reasoner.rulesys.impl.LPTopGoalIterator.checkClosed(LPTopGoalIterator.java:256)
>>
>> com.hp.hpl.jena.reasoner.rulesys.impl.LPTopGoalIterator.moveForward(LPTopGoalIterator.java:95)
>>
>> com.hp.hpl.jena.reasoner.rulesys.impl.LPTopGoalIterator.hasNext(LPTopGoalIterator.java:222)
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>>
>> com.hp.hpl.jena.util.iterator.FilterIterator.hasNext(FilterIterator.java:54)
>> com.hp.hpl.jena.util.iterator.Map1Iterator.hasNext(Map1Iterator.java:48)
>>
>> com.hp.hpl.jena.util.iterator.WrappedIterator.hasNext(WrappedIterator.java:90)
>> com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:85)
>> com.hp.hpl.jena.xmloutput.impl.Basic.writeRDFStatements(Basic.java:74)
>> com.hp.hpl.jena.xmloutput.impl.Basic.writeBody(Basic.java:48)
>>
>> com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:492)
>> com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:464)
>> com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:450)
>> com.hp.hpl.jena.rdf.model.impl.ModelCom.write(ModelCom.java:340)
>>
>> com.hp.hpl.jena.ontology.impl.OntModelImpl.writeAll(OntModelImpl.java:2650)
>>
>> On Tue, 19 Jul 2016 at 14:04, Andy Seaborne  wrote:
>>
>>> On 17/07/16 13:54, Martynas Jusevičius wrote:

 But then again, I cannot lock what I don't have: locks work on models,
>>>
>>> and

 I only get OntModel instance when getOntology() is called.

 Maybe synchronized is the solution here?
>>>
>>>
>>> You can lock how you like - the Jena lock code is helper code, to
>>> promote proper critical sections and make app writers aware that
>>> concurrency matters. It is not fundamental in any way - it's normally a
>>> a java ReentrantReadWriteLock with some tracking code to catch
>>> programming errors.
>>>
>>> If you are observing actual exceptions, it would be good to get the
>>> traces. The caches are based on Guava's thread safe cache code although
>>> (legacy) the cache setter is outside the get-or-fill operation. From
>>> reading the code, it looks like the worse that can happen is to 

Can not write to the file

2016-07-21 Thread kumar rohit
*When I run this program without writing it to the file, it runs smoothly.
But when I copy it to a file (both newly created and existing file),
sometime it adds the garbage claases to the file like Seq, Bag, Resource
and most of the time it does nothing except it empties the destination
file.*

*I have copied the whole code except the code auto generated by netbeans*





*public class NewJFrame extends javax.swing.JFrame {*






*public static void readOntology(String file,OntModel model)*

*{*


*InputStream in =FileManager.get().open(file);*



*if (in==null) {*

*throw new IllegalArgumentException( "File: " + file + " not  found");*

*}*

* model.read(in,null);*

* //in.close();}}*



 private  void read1(String str, OntModel model)

{







   String ns="
http://www.semanticweb.org/ontologies/untitled-ontology-54/;;


 OntClass user = model.createClass(ns + "User");





 OntClass user1 = model.getOntClass(ns + "User");

Individual janeSmith = user1.createIndividual(ns + str)



try {

   String file="F://newontology.owl";





   FileOutputStream f1=new FileOutputStream(file);

RDFWriter d = model.getWriter("RDF/XML-ABBREV");

d.write(model,f1,null);

}catch(Exception e) {}


 *private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  *



*OntModel model=ModelFactory.createOntologyModel();*


*String str=jTextField2.getText()*



*  read1(str,  model); }}*



* public static void main(String args[]) {*







*OntModel model = ModelFactory.createOntologyModel();*

*String file="F://updated.owl";*

* readOntology(file , model );*

*}*


Adding multiple individuals

2016-07-21 Thread neha gupta
Thank you Admin for adding me.
I am Neha and in the final semester of my Bachelor degree. My project is in
Semantic web and Jena, unfortunately.
I have read a lot about Jena and knows how to create classes and
individuals. I know how to create single individual and assign it to a
variable like

Individual janeSmith = class.createIndividual(ns + "Jane");

If we have to create two or three individuals, we will assign it to
variables and will print or do something with it.

My question here is what if we have to create hundreds of individuals and
we do not know the limit of individuals.

There are some other questions but I will try to figure it out, if could
not, will ask here.

I will be very thank full for help.


Re: TDB triple storage

2016-07-21 Thread Dave Reynolds

On 21/07/16 13:45, Chao Wang wrote:

Thanks Dave,
So my fuseki has configuration using TDB with OWL reasoner. I preloaded the TDB 
with tdbloader, then starts up fuseki.
My question is when fuseki starts up, does it load all triples including 
inferred triples into memory?


Yes. It's actually slightly worse than that. All the inferences will be 
in memory (including intermediate state) which will be bigger than than 
source data. But the data itself isn't loaded explicitly which means 
that the reasoner is going back to TDB for each query which is a further 
slow down.


Using a lighter reasoner config (OWL Micro if you are not already using 
it) may help.


Otherwise, if your data is stable, then as I say, compute the closure 
once in memory, off line. Store that in TDB. Then have your fuseki 
configuration use that precomputed closure with no runtime inference.


Dave


I am experiencing hanging sparql query. works fine with a small dataset. I am 
hoping reasoning is not done during query time...

From: Dave Reynolds [dave.e.reyno...@gmail.com]
Sent: Thursday, July 21, 2016 3:35 AM
To: users@jena.apache.org
Subject: Re: TDB triple storage

On 21/07/16 02:09, Chao Wang wrote:

A newbie question:
Does jena store the inferred triples into tdb? If yes, when?


No. The current reasoners operate in memory.

If you wish you can take the results of inference (either the entire
closure or the results of some selective queries) and store those back
in TDB yourself. A common pattern would be use separate named graphs for
the original data and for the inference closure and use union-default.
All this under your control but is not automatically done for you.

There is also some support for generating a partial RDFS inference
closure at the time you load TDB.

Dave



RE: TDB triple storage

2016-07-21 Thread Chao Wang
Thanks Dave,
So my fuseki has configuration using TDB with OWL reasoner. I preloaded the TDB 
with tdbloader, then starts up fuseki.
My question is when fuseki starts up, does it load all triples including 
inferred triples into memory?
I am experiencing hanging sparql query. works fine with a small dataset. I am 
hoping reasoning is not done during query time...

From: Dave Reynolds [dave.e.reyno...@gmail.com]
Sent: Thursday, July 21, 2016 3:35 AM
To: users@jena.apache.org
Subject: Re: TDB triple storage

On 21/07/16 02:09, Chao Wang wrote:
> A newbie question:
> Does jena store the inferred triples into tdb? If yes, when?

No. The current reasoners operate in memory.

If you wish you can take the results of inference (either the entire
closure or the results of some selective queries) and store those back
in TDB yourself. A common pattern would be use separate named graphs for
the original data and for the inference closure and use union-default.
All this under your control but is not automatically done for you.

There is also some support for generating a partial RDFS inference
closure at the time you load TDB.

Dave


Re: Web UI of Fuseki doesn't start

2016-07-21 Thread Stian Soiland-Reyes
How did you start Fuseki, from the command line?

Have you considered trying Fuseki 2.4.0 to see if that makes any difference?


On 21 July 2016 at 12:37, Sandor Kopacsi  wrote:
> Dear Jena-Fuseki Users,
>
> I started Fuseki successfully, and wanted to open its web UI, as usual on
> port 3030, but I have received the error message:
>
> "Error 404: Not Found
>
> Fuseki - version 1.4.0 (Build date: 2016-05-10T11:59:39+)"
>
> What can be the problem, and what should I do?
>
> Thanks in advance.
>
> Best Regards,
> Sandor
>
> --
> Sandor Kopacsi
> Vienna University Computer Center
>



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons
http://orcid.org/-0001-9842-9718


Web UI of Fuseki doesn't start

2016-07-21 Thread Sandor Kopacsi

Dear Jena-Fuseki Users,

I started Fuseki successfully, and wanted to open its web UI, as usual 
on port 3030, but I have received the error message:


"Error 404: Not Found

Fuseki - version 1.4.0 (Build date: 2016-05-10T11:59:39+)"

What can be the problem, and what should I do?

Thanks in advance.

Best Regards,
Sandor

--
Sandor Kopacsi
Vienna University Computer Center



Re: TDB triple storage

2016-07-21 Thread Dave Reynolds

On 21/07/16 02:09, Chao Wang wrote:

A newbie question:
Does jena store the inferred triples into tdb? If yes, when?


No. The current reasoners operate in memory.

If you wish you can take the results of inference (either the entire 
closure or the results of some selective queries) and store those back 
in TDB yourself. A common pattern would be use separate named graphs for 
the original data and for the inference closure and use union-default. 
All this under your control but is not automatically done for you.


There is also some support for generating a partial RDFS inference 
closure at the time you load TDB.


Dave