Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Lorenz B.
> OntModel model2=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); >InputStream in =FileManager.get().open("F://20-8.owl"); > if (in==null) { > throw new IllegalArgumentException( "File: " + " not > found"); > } model2.read(in,""); >

Re: Line Numbers

2017-01-17 Thread Conal Tuohy
if you want to keep track of the provenance of data, you can use named graphs. If your graphs are small (fine-grained) enough then this may give you the necessary precision to refer any triple back to its source. On 18/01/2017 7:49 am, "Grahame Grieve" wrote:

Re: Line Numbers

2017-01-17 Thread Grahame Grieve
> > Add a stage to parsing which built a Triple to location map (ParserProfile > receives the line and column number). > > The look up in that map to find the source of the triple. Imperfect in > the general case but for working on a single file it might do what you are > looking for. > yes I

Re: Line Numbers

2017-01-17 Thread Andy Seaborne
You could even ... Add a stage to parsing which built a Triple to location map (ParserProfile receives the line and column number). The look up in that map to find the source of the triple. Imperfect in the general case but for working on a single file it might do what you are looking for.

Re: Line Numbers

2017-01-17 Thread A. Soroka
There are several answers. There is no reason to suppose that any given triple actually derives from a file at all. It might have been created programmatically, or by inference, or from SPARQL, amongst many possible other means. You are suggesting the carriage of a really large amount of

Re: Line Numbers

2017-01-17 Thread Grahame Grieve
hi Yes replacing a library is not simple, but I thought I'd still make the offer. Other advantages... no, it's just a JSON parser. > You did seem to be asking for a way to get from a triple in a graph to the line where it was read, and that is not possible. There is no such association. why

Re: Line Numbers

2017-01-17 Thread A. Soroka
Replacing the JSON library in use is a considerably bigger proposition than working with the one we now use in a different way. Are there other advantages to using your custom code? We want to stick to well-supported dependencies unless there is a convincing argument otherwise. As for Turtle,

Re: Line Numbers

2017-01-17 Thread Andy Seaborne
RDF does not have the concept of an order to triples and indeed triples can be added and deleted to the set of triples from different places. What you can do is to add stages to the parsing process to produce messages as parsing happens. Andy On 17/01/17 19:42, Grahame Grieve wrote:

Re: Line Numbers

2017-01-17 Thread A. Soroka
You did seem to be asking for a way to get from a triple in a graph to the line where it was read, and that is not possible. There is no such association. Andy is pointing out that only during parsing can such information be managed (and I pointed out that even that is not the case all the

Re: Line Numbers

2017-01-17 Thread Grahame Grieve
I'm not sure where that means it's not possible or of interest to trace the triples (or their parts) to source files Grahame On Wed, Jan 18, 2017 at 6:47 AM, Andy Seaborne wrote: > RDF does not have the concept of an order to triples and indeed triples > can be added and

Re: Line Numbers

2017-01-17 Thread Grahame Grieve
well, I care about turtle and json-ld. I can contribute a json library that preserves line numbers when the json is parsed, since the main stream ones don't. Grahame On Wed, Jan 18, 2017 at 5:38 AM, A. Soroka wrote: > That will depend a bit on the language. For example,

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
OntModel model2=ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM); InputStream in =FileManager.get().open("F://20-8.owl"); if (in==null) { throw new IllegalArgumentException( "File: " + " not found"); } model2.read(in,"");

Re: Line Numbers

2017-01-17 Thread A. Soroka
That will depend a bit on the language. For example, JSON parsing doesn't occur directly in Jena, Jena uses a library that parses from JSON to Java objects and then works with those objects: org.apache.jena.riot.lang.JsonLDReader.read(InputStream, String, ContentType, StreamRDF, Context) In

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Andy Seaborne
A Complete, Minimal Example please. Partial code, no data is not complete. It must compile and run to be complete. Minimal means only what is necessary to ask the question not the whole data or whole application. Andy On 17/01/17 17:14, Sidra shah wrote: I am surprise that when there

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
I am surprise that when there is no value in BestCategory, it gives me no error and when the rule executes and value comes in BestCategory, it gives me now *"RequiredLiteralException*" The code I used here is OntProperty favcat=model2.getOntProperty(ns+ "BestCategory"); RDFNode

Re: Experience with large number (e.g. 1M) of Named Graphs in Fuseki?

2017-01-17 Thread Andy Seaborne
If you are using TDB, and since Fuseki 2.4.0, for in memory, graph is treated just as a column like subject or predicate or object. It does not make much difference; some more indexing (and even then if necessary you can tune it). Default union graph works and does not care much either. You

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hello Chris, thanks a lot for your suggestion. Best regards. On Tue, Jan 17, 2017 at 5:37 PM, Chris Dollin wrote: > > > On 17/01/17 13:30, Sidra shah wrote: > >> Hi Lorenz, I am sorry but with much regards, you discussed here the >> problem, not the solution :)

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Chris Dollin
On 17/01/17 13:30, Sidra shah wrote: Hi Lorenz, I am sorry but with much regards, you discussed here the problem, not the solution :) :) I know this if there is no value, there must be Null exception, This is not true. but can you suggest me a way where we dodge the compiler No

Re: Listing only asserted propeties Vs filtering property lists

2017-01-17 Thread Dave Reynolds
On 17/01/17 13:02, Jos Lehmann wrote: Hi there I am copying Classes and/or Instances as well as their properties from one ontology to another. To get the list of Classe and/or Instance properties from the source ontology I use listProperties() But this gives much more than I need: i.e.

Re: Experience with large number (e.g. 1M) of Named Graphs in Fuseki?

2017-01-17 Thread Daniel Hernandez
I do a benchmark with different models with the same data. One model had more than 65 millions of named graphs. Fuseki had no problems with named compared with storing the same data in a single graph. You can see the results of the benchmark in:

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hello Lorenz, sorry to bother you. What if we use RDFNode physicsBestCat=indiv.getPropertyValue(bestcat); if (null!=phsicsBestCat) { Literal l1=physicsBestCat.asLiteral(); String s1=l1.toString();} In fact, I tried this and it does not give exception, but dont know about the

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hi Lorenz, I am sorry but with much regards, you discussed here the problem, not the solution :) :) I know this if there is no value, there must be Null exception, but can you suggest me a way where we dodge the compiler and it skip the lines when there is no value. I know this is more a Java

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Lorenz B.
no no no, I told you that the method getPropertyValue(p) can return NULL if there is no such value for the given property p That means what for your line RDFNode physicsBestCat=indiv.getPropertyValue(bestcat); ? Right, physicsBestCat can be NULL. That means what for your line

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
I mean Lorenz, is there any way, if there is no value, it do nothing (do not give exception) and if there is value, it should simply give us the value. if (l1!=null) supposed to work. :) Is it possible if we use something if (li==null) break; And we should get out of this snippet? Regards On

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Lorenz B.
??? if there is no such value you can't get the value, I do not see the problem > Hello Lorenz, thanks. > > Is there any way (alternative) to get this value as I need it further in my > operation? > > Regards > > On Tue, Jan 17, 2017 at 4:03 PM, Lorenz B. < > buehm...@informatik.uni-leipzig.de>

Re: AW: AW: Listing all individuals of an ontology, including those defined in the ontology as individuals of classes coming from import ontology

2017-01-17 Thread Lorenz B.
I do not understand. I meant that the URIs can't be resolved, you can try it in the browser or using curl, wget etc. You have to use the URIs resp. URLs where your ontologies exist, I don't know where this is in your environment. > Hi Lorenz > > I see -- how should the URI be given? > > Thanks,

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hello Lorenz, thanks. Is there any way (alternative) to get this value as I need it further in my operation? Regards On Tue, Jan 17, 2017 at 4:03 PM, Lorenz B. < buehm...@informatik.uni-leipzig.de> wrote: > > > > Hello Lorenz, believe me I have tried this before I write my problem here > > in

AW: AW: Listing all individuals of an ontology, including those defined in the ontology as individuals of classes coming from import ontology

2017-01-17 Thread Jos Lehmann
Hi Lorenz I see -- how should the URI be given? Thanks, Jos -Ursprüngliche Nachricht- Von: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de] Gesendet: Dienstag, 17. Januar 2017 13:57 An: users@jena.apache.org Betreff: Re: AW: Listing all individuals of an ontology, including those

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Lorenz B.
> Hello Lorenz, believe me I have tried this before I write my problem here > in the forum but the problem persists. I also tried if s1!=null. . > > RDFNode physicsBestCat=indiv.getPropertyValue(bestcat); But then the NullPointerException already occurs here. getPropertyValue can return NULL if

Listing only asserted propeties Vs filtering property lists

2017-01-17 Thread Jos Lehmann
Hi there I am copying Classes and/or Instances as well as their properties from one ontology to another. To get the list of Classe and/or Instance properties from the source ontology I use listProperties() But this gives much more than I need: i.e. superproperties, as well as other stuff,

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hello Lorenz, believe me I have tried this before I write my problem here in the forum but the problem persists. I also tried if s1!=null. . RDFNode physicsBestCat=indiv.getPropertyValue(bestcat); Literal l1=physicsBestCat.asLiteral(); if (l1!=null){ String

Re: AW: Listing all individuals of an ontology, including those defined in the ontology as individuals of classes coming from import ontology

2017-01-17 Thread Lorenz B.
It does but not if the URI are given as you've shown. Both URIs can't be resolved to ontology files. > Hi Andreas, > > Yes, I had not read in the import ontology. I thought that would be > automatic. > > Thanks, Jos > > > -Ursprüngliche Nachricht- > Von: Andreas Prieß

AW: Listing all individuals of an ontology, including those defined in the ontology as individuals of classes coming from import ontology

2017-01-17 Thread Jos Lehmann
Hi Andreas, Yes, I had not read in the import ontology. I thought that would be automatic. Thanks, Jos -Ursprüngliche Nachricht- Von: Andreas Prieß [mailto:a...@metaphysis.net] Gesendet: Samstag, 14. Januar 2017 19:47 An: users@jena.apache.org Betreff: Re: Listing all individuals of

Re: How I handle "Null Pointer Exception"

2017-01-17 Thread Lorenz B.
Sorry, but the answer is too obvious, especially for a student in computer science. What about checking if the literal is NULL before calling toString()? > Hello, I asked about this rule few days ago. > String rule ="[rule1: ( ?x http://www.semanticweb.org/t/o >

How I handle "Null Pointer Exception"

2017-01-17 Thread Sidra shah
Hello, I asked about this rule few days ago. String rule ="[rule1: ( ?x http://www.semanticweb.org/t/o ntologies/2016/7/myOWL#Physics_Preferred_Category ?cat1 )" + "( ?x http://www.semanticweb.org/t/ontologies/2016/7/myOWL#Chem_Pr eferred_Category ?cat2 )" + // "( ?x

Re: Experience with large number (e.g. 1M) of Named Graphs in Fuseki?

2017-01-17 Thread Nikolaos Beredimas
My first guess would be no, it wouldn't hurt performance. Although I have limited experience on Fuseki (just using it as a second test endpoint to verify SPARQL compatibility), I am using a similar approach on a different RDF store (currently at about 650,000 graphs on one deployment) I would

Experience with large number (e.g. 1M) of Named Graphs in Fuseki?

2017-01-17 Thread Conal Tuohy
I am working with Fuseki 2 using the SPARQL Named Graph protocol, and I wondered if there are practical limits on the number of named graphs in the graph store? I know that many people use Jena only with a very small number of distinct graphs, and I noticed that Fuseki's own user interface really