Re: leave mailing list

2016-09-22 Thread Andy Seaborne

Send an email to users-unsubscr...@jena.apache.org

http://jena.apache.org/help_and_support/index.html

   Andy

On 22/09/16 21:16, Farzaneh Taleb wrote:

I want to leave this mailing list and not receive emails anymore.
How can I do that?
Thank's



leave mailing list

2016-09-22 Thread Farzaneh Taleb
I want to leave this mailing list and not receive emails anymore.
How can I do that?
Thank's


Re: Picture of Dbpedia resource

2016-09-22 Thread A. Soroka
Jena does not render SVG graphics. It is an RDF framework and that is not at 
all part of its purpose. There are many other projects available that have this 
as a supported purpose:

https://www.google.com/search?q=java+svg

---
A. Soroka
The University of Virginia Library

> On Sep 22, 2016, at 6:27 AM, tina sani  wrote:
> 
> Hi
> 
> If I download the depiction/picture from Dbpedia about a resource such as
> Berlin, import it in Protege as:
> 
>  
> "Coat_of_arms_of_Berlin.svg"
> 
> Then how can I display it using Jena code.



Node equality issue

2016-09-22 Thread Luis Daniel Ibáñez González
Hi,

I am extracting the subjects,predicates and objects in queries in log by
using this handy snippet here [1]. My goal is to compare them with other
sets of Nodes coming from other sources.
However, the .equals between the Node coming from the snippet and a Node
created with NodeFactory is not working as expected. Roughly:

Node var = NodeFactory.createVariable("movie");
QueryStr = "SELECT ?movie WHERE {?movie ...}" ;
Got the subjects of the query with [1], that is, a set containing the
variable '?movie' (let's call it 'sub')

My issue is that sub.equals(var) is false when I expected the opposite.

What I'm missing here?

I'm attaching a minimal test case for those keen to execute it.

Regards,
Luis.

P.S. ARQ 3.1.0 from maven repo on Java 8, if it matters.

[1]
http://stackoverflow.com/questions/15203838/how-to-get-all-of-the-subjects-of-a-jena-query

-- 
Ing. Luis Daniel Ibáñez G.
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package soton.wais.queryanalyzer;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.NodeFactory;
import org.apache.jena.query.Query;
import org.apache.jena.query.QueryFactory;
import org.apache.jena.sparql.core.TriplePath;
import org.apache.jena.sparql.syntax.ElementPathBlock;
import org.apache.jena.sparql.syntax.ElementVisitorBase;
import org.apache.jena.sparql.syntax.ElementWalker;

/**
 *
 * @author ldig
 */
public class MUTCNodeEquality {

	public static Set getSubjects(Query query){
	  final Set subjects = new HashSet<>();

  // This will walk through all parts of the query
		  ElementWalker.walk(query.getQueryPattern(),
			  // For each element...
			  new ElementVisitorBase() {
  // ...when it's a block of triples...
  @Override
  public void visit(ElementPathBlock el) {
	  // ...go through all the triples...
	  Iterator triples = el.patternElts();
	  while (triples.hasNext()) {
		  // ...and grab the subject
		  subjects.add(triples.next().getSubject());
	  }
}
			}
		);
		 return subjects;
	}


	public static void main(String[] args){
		
		Query q = QueryFactory.create("PREFIX dbo:" +
			 " SELECT ?movie (avg(?runtime) as ?avgrt) WHERE {" +
			 "?movie dbo:runtime ?runtime ." +
			 "?movie dbo:starring " +
			 "} GROUP BY ?movie");
		
		Set subjects = getSubjects(q); 
		// result is {?movie}
		
		Node s = NodeFactory.createVariable("movie");
		Iterator iter = subjects.iterator();
		while(iter.hasNext()){
			Node node = iter.next();
			if(node.equals(s)){
			System.out.println("Nodes are equal, same label");
			}else{
			System.out.println("Same label, but not equal :(");
			};
		}
		
	
	}
	
}


Re: Picture of Dbpedia resource

2016-09-22 Thread Andy Seaborne



On 22/09/16 11:27, tina sani wrote:

Hi

If I download the depiction/picture from Dbpedia about a resource such as
Berlin, import it in Protege as:

 


Wrong predicate for foaf:depiction: it is
   http://xmlns.com/foaf/0.1/depication


"Coat_of_arms_of_Berlin.svg"


That is not the result of result of querying DBpedia where you get a URL 
for the depiction.


Then how can I display it using Jena code.


Jena does not have an SVG viewer.

Try sending the URL for the depcition to your local browser.

Andy





Re: Question about RDF collections

2016-09-22 Thread Laurent Rucquoy
Thank you all for your help !

On 22 September 2016 at 14:20, Nikolaos Beredimas  wrote:

> Just remember that there is no ordering in this.
>
> [Document_A] --contains--> [Paragraph_1]
> [Document_A] --contains--> [Paragraph_2]
> [Document_B] --contains--> [Paragraph_2]
>
> is equivalent to
>
> [Document_A] --contains--> [Paragraph_2]
> [Document_B] --contains--> [Paragraph_2]
> [Document_A] --contains--> [Paragraph_1]
>
>
> On Thu, Sep 22, 2016 at 3:14 PM, Laurent Rucquoy <
> laurent.rucq...@telemis.com> wrote:
>
> > I have a "Document" resource which could contain many "Paragraph"
> > resources.
> > A same "Paragraph" resource could also be contained by different
> "Document"
> > resources.
> >
> > What is the most relevant model to translate such a case in RDF ?
> > I have two solutions:
> >
> > Solution 1 (using RDF collections)
> > [Document_A] --contains--> ( [Paragraph_1], [Paragraph_2] )
> > [Document_B] --contains--> ( [Paragraph_2] )
> >
> > or
> >
> > Solution 2 (defining the same predicate several times on the same
> subject)
> > [Document_A] --contains--> [Paragraph_1]
> > [Document_A] --contains--> [Paragraph_2]
> > [Document_B] --contains--> [Paragraph_2]
> >
> >
> > I think that the Solution 1 requires complex and resource-consuming
> SPARQL
> > update.
> > So to keep it simple, I would choose the Solution 2. But, I don't know if
> > it's safe and if it's a good practice to define the same predicate
> several
> > times on the same subject ?
> >
> > Thank you in advance for your help.
> >
> > Regards,
> > Laurent
> >
>


Re: Question about RDF collections

2016-09-22 Thread Nikolaos Beredimas
Just remember that there is no ordering in this.

[Document_A] --contains--> [Paragraph_1]
[Document_A] --contains--> [Paragraph_2]
[Document_B] --contains--> [Paragraph_2]

is equivalent to

[Document_A] --contains--> [Paragraph_2]
[Document_B] --contains--> [Paragraph_2]
[Document_A] --contains--> [Paragraph_1]


On Thu, Sep 22, 2016 at 3:14 PM, Laurent Rucquoy <
laurent.rucq...@telemis.com> wrote:

> I have a "Document" resource which could contain many "Paragraph"
> resources.
> A same "Paragraph" resource could also be contained by different "Document"
> resources.
>
> What is the most relevant model to translate such a case in RDF ?
> I have two solutions:
>
> Solution 1 (using RDF collections)
> [Document_A] --contains--> ( [Paragraph_1], [Paragraph_2] )
> [Document_B] --contains--> ( [Paragraph_2] )
>
> or
>
> Solution 2 (defining the same predicate several times on the same subject)
> [Document_A] --contains--> [Paragraph_1]
> [Document_A] --contains--> [Paragraph_2]
> [Document_B] --contains--> [Paragraph_2]
>
>
> I think that the Solution 1 requires complex and resource-consuming SPARQL
> update.
> So to keep it simple, I would choose the Solution 2. But, I don't know if
> it's safe and if it's a good practice to define the same predicate several
> times on the same subject ?
>
> Thank you in advance for your help.
>
> Regards,
> Laurent
>


Re: Question about RDF collections

2016-09-22 Thread Martynas Jusevičius
It is not only safe, but completely normal and used much, much more
frequently than solution 1. Remember, RDF is a graph, so you can
connect resource nodes however you like.

Collection could be useful here if you want to maintain the ordering
of Paragraphs in a Document.

On Thu, Sep 22, 2016 at 2:14 PM, Laurent Rucquoy
 wrote:
> I have a "Document" resource which could contain many "Paragraph" resources.
> A same "Paragraph" resource could also be contained by different "Document"
> resources.
>
> What is the most relevant model to translate such a case in RDF ?
> I have two solutions:
>
> Solution 1 (using RDF collections)
> [Document_A] --contains--> ( [Paragraph_1], [Paragraph_2] )
> [Document_B] --contains--> ( [Paragraph_2] )
>
> or
>
> Solution 2 (defining the same predicate several times on the same subject)
> [Document_A] --contains--> [Paragraph_1]
> [Document_A] --contains--> [Paragraph_2]
> [Document_B] --contains--> [Paragraph_2]
>
>
> I think that the Solution 1 requires complex and resource-consuming SPARQL
> update.
> So to keep it simple, I would choose the Solution 2. But, I don't know if
> it's safe and if it's a good practice to define the same predicate several
> times on the same subject ?
>
> Thank you in advance for your help.
>
> Regards,
> Laurent


Re: Question about RDF collections

2016-09-22 Thread Joshua TAYLOR
On Thu, Sep 22, 2016 at 8:14 AM, Laurent Rucquoy
 wrote:
> But, I don't know if
> it's safe and if it's a good practice to define the same predicate several
> times on the same subject ?

It's absolutely fine.  That's how, e.g., DBpedia stores abstracts in
different languages:

article dbpedia-owl:abstract "abstract in english"@en .
article dbpedia-owl:abstract "abstract in french"@fr .
article dbpedia-owl:abstract "abstract in italian"@it .



-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/


Question about RDF collections

2016-09-22 Thread Laurent Rucquoy
I have a "Document" resource which could contain many "Paragraph" resources.
A same "Paragraph" resource could also be contained by different "Document"
resources.

What is the most relevant model to translate such a case in RDF ?
I have two solutions:

Solution 1 (using RDF collections)
[Document_A] --contains--> ( [Paragraph_1], [Paragraph_2] )
[Document_B] --contains--> ( [Paragraph_2] )

or

Solution 2 (defining the same predicate several times on the same subject)
[Document_A] --contains--> [Paragraph_1]
[Document_A] --contains--> [Paragraph_2]
[Document_B] --contains--> [Paragraph_2]


I think that the Solution 1 requires complex and resource-consuming SPARQL
update.
So to keep it simple, I would choose the Solution 2. But, I don't know if
it's safe and if it's a good practice to define the same predicate several
times on the same subject ?

Thank you in advance for your help.

Regards,
Laurent


Picture of Dbpedia resource

2016-09-22 Thread tina sani
Hi

If I download the depiction/picture from Dbpedia about a resource such as
Berlin, import it in Protege as:

 
"Coat_of_arms_of_Berlin.svg"

Then how can I display it using Jena code.


Re: Ontclass vs OntResource

2016-09-22 Thread Dave Reynolds

On 22/09/16 08:41, neha gupta wrote:

What is the basic difference between model.createResource() and
model.createOntClass()?



Just to add to what Lorenz has already explained ...

In programming terms then model.createResource() does not change the 
contents of the model, it just gives you a java object which could use 
to lookup property values or add them.


OntModel.createOntClass() will change the model, it will add a statement 
of the form:


   [] a owl:Class

or

   [] a rdfs:Class

depending on which language profile your OntModel is.

Dave


Re: Ontclass vs OntResource

2016-09-22 Thread Lorenz B.
It is plain RDF, please have a look at the RDF data model.
It's just an RDF resource, neither an RDF property nor an RDFS class.
This will be inferred once you use it in specific triples, see the
RDF/RDFS entailment rules

> I am confuse about RDF Resource, with createResource() I do not know a
> class is created, an individual or a property is created?
>
> Man drives Car.
> Man and Car are classes here, drives predicates, so in this case what will
> be the Resource?
>
> On Thu, Sep 22, 2016 at 1:02 AM, Lorenz B. <
> buehm...@informatik.uni-leipzig.de> wrote:
>
>> Resource: RDF resource
>> OntClass: OWL class
>>
>>> What is the basic difference between model.createResource() and
>>> model.createOntClass()?
>>>
>> --
>> Lorenz Bühmann
>> AKSW group, University of Leipzig
>> Group: http://aksw.org - semantic web research center
>>
>>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center



Re: Ontclass vs OntResource

2016-09-22 Thread neha gupta
I am confuse about RDF Resource, with createResource() I do not know a
class is created, an individual or a property is created?

Man drives Car.
Man and Car are classes here, drives predicates, so in this case what will
be the Resource?

On Thu, Sep 22, 2016 at 1:02 AM, Lorenz B. <
buehm...@informatik.uni-leipzig.de> wrote:

> Resource: RDF resource
> OntClass: OWL class
>
> > What is the basic difference between model.createResource() and
> > model.createOntClass()?
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>


Re: Ontclass vs OntResource

2016-09-22 Thread Lorenz B.
Resource: RDF resource
OntClass: OWL class

> What is the basic difference between model.createResource() and
> model.createOntClass()?
>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center



Ontclass vs OntResource

2016-09-22 Thread neha gupta
What is the basic difference between model.createResource() and
model.createOntClass()?