Re: error running rdfstats

2015-03-02 Thread Carmen Manzulli
ok...it was a problem due to the hadoop configuration files!thanks a
lotnow rdfstats starts! :D

2015-02-23 10:55 GMT+01:00 Rob Vesse rve...@dotnetrdf.org:

 If there job is stuck in a Pending state that is usually an issue with the
 configuration of your Hadoop cluster e.g. insufficient resources

 Those kinds of questions are best addressed to the Hadoop community or
 your Hadoop distribution vendor if you are using a non-Apache distribution

 Rob

 On 20/02/2015 14:07, Carmen Manzulli carmenmanzu...@gmail.com wrote:

 ok...now it seems to be able to start to execute the job but it rest in
 pending status for a lot..what kind of problem could be ?
 
 2015-02-20 11:29 GMT+01:00 Carmen Manzulli carmenmanzu...@gmail.com:
 
  Thanks a lotI was thinking about a Hadoop configuration
 problem..sorry
  for this question..
 
  2015-02-19 19:01 GMT+01:00 Rob Vesse rve...@dotnetrdf.org:
 
  --nodecount is not a valid argument so it is being treated as a file
 name
 
  The correct argument is --node-count
 
  Rob
 
  On 19/02/2015 16:12, Carmen Manzulli carmenmanzu...@gmail.com
 wrote:
 
  Hi,
  i don't know why but i'm getting this error:
  
  
  Input path does not exist:
 hdfs://master:54310/user/sisinflab/--nodecount
  org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input
 path
  does not exist: hdfs://master:54310/user/sisinflab/--nodecount
  at
 
 
 org.apache.hadoop.mapreduce.lib.input.FileInputFormat.singleThreadedLis
 tSt
  atus(FileInputFormat.java:321)
  at
 
 
 org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileIn
 put
  Format.java:264)
  at
 
 
 org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getSplits(FileInp
 utF
  ormat.java:385)
  at
 
 
 org.apache.hadoop.mapreduce.JobSubmitter.writeNewSplits(JobSubmitter.ja
 va:
  597)
  at
 
 
 org.apache.hadoop.mapreduce.JobSubmitter.writeSplits(JobSubmitter.java:
 614
  )
  at
 
 
 org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter
 .ja
  va:492)
  at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1296)
  at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1293)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAs(Subject.java:415)
  at
 
 
 org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformati
 on.
  java:1628)
  at org.apache.hadoop.mapreduce.Job.submit(Job.java:1293)
  at
  org.apache.jena.hadoop.rdf.stats.RdfStats.runJob(RdfStats.java:297)
  at
 
 
 org.apache.jena.hadoop.rdf.stats.RdfStats.computeStatistic(RdfStats.jav
 a:2
  78)
  at
 org.apache.jena.hadoop.rdf.stats.RdfStats.run(RdfStats.java:264)
  at
 org.apache.jena.hadoop.rdf.stats.RdfStats.run(RdfStats.java:180)
  at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
  at
 org.apache.jena.hadoop.rdf.stats.RdfStats.main(RdfStats.java:136)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at
 
 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
 va:
  57)
  at
 
 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
 rIm
  pl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
  at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
  
  
   when i try to run the command:
  
  hadoop jar
 
 
 /home/sisinflab/NetBeansProjects/prova/target/prova-1.0-SNAPSHOT-jar-wi
 th-
  dependencies.jar
  org.apache.jena.hadoop.rdf.stats.RdfStats --nodecount --data-types
  --namespaces --output hdfs:///prove/output --input-type triples
  hdfs:///input/persondata_en.ttl
  
  
  could anyone help me?
  thanks in advance
 
 
 
 
 
 







Re: model.empty()

2015-03-02 Thread Martynas Jusevičius
model.isEmpty() should be enough:
http://jena.apache.org/documentation/javadoc/jena/com/hp/hpl/jena/rdf/model/Model.html#isEmpty()

On Mon, Mar 2, 2015 at 6:58 PM, Maarten van Dessel
maarten.vandes...@ugent.be wrote:
 I'm sorry for the inconvenience, it was a mistake on my end.
 Apparently  model.listStatements.hasNext()  does seem to test correctly if 
 a model is empty.


 Op 2-mrt.-2015, om 18:04 heeft Martynas Jusevičius marty...@graphity.org 
 het volgende geschreven:

 What's the query code? You are probably querying from an inferencing
 model that imports example.com ontology.

 On Mon, Mar 2, 2015 at 4:58 PM, Maarten van Dessel
 maartenvandes...@hotmail.com wrote:
 Hi everyone,

 I'm using construct queries in a project. I want to make decisions based on 
 wether the constructed model contains any data. Is there any way on how 
 this can be known?

 Example query:
 CONSTRUCT
{ ?person http://example.com#hasStatus http://example.com#Occupied .}
 WHERE
{ ?person  http://example.com#hasStatus  http://example.com#Free .}

 Printing the resulting model (which seems empty):
 rdf:RDF
xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
xmlns:owl=http://www.w3.org/2002/07/owl#;
xmlns:example=http://example.com#;
xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema#;
xmlns:xsd=http://www.w3.org/2001/XMLSchema#; 
 /rdf:RDF

 My attempt to check wether a model is empty:
 StmtIterator nodeIterator = model.listStatements();
 if (nodeIterator.hasNext()) {
// do something
 }

 This however doesn't work, since there are still triples returned in the 
 iterator:
 [http://example.com#hasStatus,
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
 http://www.w3.org/2002/07/owl#ObjectProperty]

 Any thoughts are appreciated.

 Thanks,

 Maarten



Print a model without the option ^^http://www.w3.org/2001/XMLSchema#string

2015-03-02 Thread Marco Tenti
Hi, everyone,  my question today is a little strange but i need it for a
integration with a exisisting project, there is a way to write  a model
without the option of the literal object? In the specific only for the
string object.
I solved for now with other java code (Scanner,read,replace,ecc.) but I wanted
to know if jena allows me to do it directly in some way, for example:

I have this:

Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#string
...

Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#long
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#decimal
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#string

but i want to print this:
Subject Predicate myLiteralString
...
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#long
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#decimal
Subject Predicate myLiteralString

Ty, in advance. greetings.


TripleFilterBySubjectUriMapper information

2015-03-02 Thread Carmen Manzulli
Hi all,
I'm carmen and I want to ask you if there are some specific MapOutputKey
and MapOutputValue classes to indicate when execute
TrypleFilterBySubjectMapper

thank you in advance for the answer. :)
Carmen.


Re: Print a model without the option ^^http://www.w3.org/2001/XMLSchema#string

2015-03-02 Thread Stian Soiland-Reyes
What if you try something like this?

https://gist.github.com/stain/be58129e5ac382668f53


public static class SimpleLiteralStreamRDF extends StreamRDFProxy {
public SimpleLiteralStreamRDF(StreamRDF writer) {
super(writer);
}

@Override
public void triple(Triple triple) {
Node object = triple.getObject();
if (object.isLiteral()) {
Literal literal =
ResourceFactory.createPlainLiteral(object.getLiteralLexicalForm());
triple = new Triple(triple.getSubject(),
triple.getPredicate(), literal.asNode());
}
super.triple(triple);
}
}


Model model = ModelFactory.createDefaultModel();
model.add(ResourceFactory.createResource(),
ResourceFactory.createProperty(http://example.com/hasDouble;),
ResourceFactory.createTypedLiteral(13.37,
XSDDatatype.XSDdouble));
model.add(ResourceFactory.createResource(),
ResourceFactory.createProperty(http://example.com/hasString;),
ResourceFactory.createTypedLiteral(uhu,
XSDDatatype.XSDstring));
model.add(ResourceFactory.createResource(),
ResourceFactory.createProperty(http://example.com/hasLang;),
ResourceFactory.createLangLiteral(Hello, en-GB));


final StreamRDF writer =
StreamRDFWriter.getWriterStream(System.out, Lang.TURTLE);
StreamRDF literalWriter = new SimpleLiteralStreamRDF(writer);
StreamOps.graphToStream(model.getGraph(), literalWriter);



The above outputs:

_:b0http://example.com/hasLang  Hello .
_:b1http://example.com/hasDouble  13.37 .
_:b2http://example.com/hasString  uhu .




Note that I could not quickly find the equivalent of my StreamRDFProxy
(see the gist) - PipedTriplesStream is not quite that as it needs a
PipedRDFIterator instead of another StreamRDF.

On 2 March 2015 at 14:53, Marco Tenti tentimar...@gmail.com wrote:
 Hi, everyone,  my question today is a little strange but i need it for a
 integration with a exisisting project, there is a way to write  a model
 without the option of the literal object? In the specific only for the
 string object.
 I solved for now with other java code (Scanner,read,replace,ecc.) but I wanted
 to know if jena allows me to do it directly in some way, for example:

 I have this:

 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#string
 ...

 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#long
 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#decimal
 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#string

 but i want to print this:
 Subject Predicate myLiteralString
 ...
 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#long
 Subject Predicate myLiteralString^^
 http://www.w3.org/2001/XMLSchema#decimal
 Subject Predicate myLiteralString

 Ty, in advance. greetings.



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


Re: Print a model without the option ^^http://www.w3.org/2001/XMLSchema#string

2015-03-02 Thread Andy Seaborne

On 02/03/15 14:53, Marco Tenti wrote:

Hi, everyone,  my question today is a little strange but i need it for a
integration with a exisisting project, there is a way to write  a model
without the option of the literal object? In the specific only for the
string object.
I solved for now with other java code (Scanner,read,replace,ecc.) but I wanted
to know if jena allows me to do it directly in some way, for example:

I have this:

Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#string
...

Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#long
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#decimal
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#string

but i want to print this:
Subject Predicate myLiteralString
...
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#long
Subject Predicate myLiteralString^^
http://www.w3.org/2001/XMLSchema#decimal
Subject Predicate myLiteralString

Ty, in advance. greetings.



i.e. write xsd:string as a simple literal.

That's what you will get in RDF 1.1.  All simple literals are xsd:string 
and output does not print the ^^xsd:string.


In RDF 1.0 (RDF 2004, RDF current), they are different RDF terms.

The next release of Jena will have all the machinery for RDF 1.1 but 
it's switched off by default.  The plan is to turn it on at Jena3 
because it impacts persistent data (TDB, SDB).


You can try that, at your own risk, by taking a development build (or 
the next release 2.13.0) and setting


  JenaRuntime.isRDF11 = true ;

Do not run on a database if your data has any xsd:strings in it as yours 
clearly has.


Also, if anyone is building directly from git, the tests will not all 
pass ... the first test is whether the system is in RDF 1.0 mode, not 
RDF 1.1, to make sure a release does not slip out with the wrong 
setting.  There are some ARQ tests that change - and a conversion script 
in the source tree.


Andy





model.empty()

2015-03-02 Thread Maarten van Dessel
Hi everyone,

I'm using construct queries in a project. I want to make decisions based on 
wether the constructed model contains any data. Is there any way on how this 
can be known?

Example query:
CONSTRUCT 
{ ?person http://example.com#hasStatus http://example.com#Occupied .}
WHERE
{ ?person  http://example.com#hasStatus  http://example.com#Free .}

Printing the resulting model (which seems empty):
rdf:RDF
xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
xmlns:owl=http://www.w3.org/2002/07/owl#;
xmlns:example=http://example.com#;
xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema#;
xmlns:xsd=http://www.w3.org/2001/XMLSchema#;  
/rdf:RDF

My attempt to check wether a model is empty:
StmtIterator nodeIterator = model.listStatements();
if (nodeIterator.hasNext()) {
// do something
}

This however doesn't work, since there are still triples returned in the 
iterator:
[http://example.com#hasStatus,
http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
http://www.w3.org/2002/07/owl#ObjectProperty]

Any thoughts are appreciated.

Thanks,

Maarten


Re: model.empty()

2015-03-02 Thread Maarten van Dessel
I'm sorry for the inconvenience, it was a mistake on my end.
Apparently  model.listStatements.hasNext()  does seem to test correctly if a 
model is empty.


 Op 2-mrt.-2015, om 18:04 heeft Martynas Jusevičius marty...@graphity.org 
 het volgende geschreven:
 
 What's the query code? You are probably querying from an inferencing
 model that imports example.com ontology.
 
 On Mon, Mar 2, 2015 at 4:58 PM, Maarten van Dessel
 maartenvandes...@hotmail.com wrote:
 Hi everyone,
 
 I'm using construct queries in a project. I want to make decisions based on 
 wether the constructed model contains any data. Is there any way on how this 
 can be known?
 
 Example query:
 CONSTRUCT
{ ?person http://example.com#hasStatus http://example.com#Occupied .}
 WHERE
{ ?person  http://example.com#hasStatus  http://example.com#Free .}
 
 Printing the resulting model (which seems empty):
 rdf:RDF
xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
xmlns:owl=http://www.w3.org/2002/07/owl#;
xmlns:example=http://example.com#;
xmlns:rdfs=http://www.w3.org/2000/01/rdf-schema#;
xmlns:xsd=http://www.w3.org/2001/XMLSchema#; 
 /rdf:RDF
 
 My attempt to check wether a model is empty:
 StmtIterator nodeIterator = model.listStatements();
 if (nodeIterator.hasNext()) {
// do something
 }
 
 This however doesn't work, since there are still triples returned in the 
 iterator:
 [http://example.com#hasStatus,
 http://www.w3.org/1999/02/22-rdf-syntax-ns#type,
 http://www.w3.org/2002/07/owl#ObjectProperty]
 
 Any thoughts are appreciated.
 
 Thanks,
 
 Maarten