Hi all, what is the best way to count the inferred triples after loading the input data and ontology?

asked 10 May '13, 13:53

Josef%20Hardi's gravatar image

Josef Hardi
16112
accept rate: 0%

edited 13 May '13, 01:57

baz's gravatar image

baz ♦♦
33128


When no FROM or FROM NAMED clauses are present in the query, the default graph in OWLIM's SPARQL processor's RDF dataset will contain the RDF merge of all triples in the repository. So the above query will count all explicit and inferred triples merged across all named graphs, which will be less than or equal to the actual number of RDF statements from all named graphs and the default graph - if a triple occurs in two or more separate named graphs then it will only be counted once.

Since all inferred triples are stored in the default graph, then a special OWLIM trick can be used to count only inferred statements:

SELECT (COUNT(*) as ?count)
FROM <http://www.ontotext.com/implicit>
WHERE {
   ?s ?p ?o .
}

This should give you the result you need.

link

answered 13 May '13, 01:47

baz's gravatar image

baz ♦♦
33128
accept rate: 36%

edited 13 May '13, 01:47

Is that FROM always valid? Did not work for me, that limited the count to 0.

(06 Jun '13, 09:41) uprego

With OWLIM, if you have programming capabilities and the proper permissions, you can also get the implicit count as the total number of rows substracting the explicit count obtained as using RepositoryConnection.size(). Works for me. All the time.

link

answered 01 Jul '13, 03:59

uprego's gravatar image

uprego
161
accept rate: 0%

I found the solution, using count() keyword

SELECT (count(*) as ?count) WHERE {
   ?s ?p ?o .
}
link

answered 10 May '13, 15:49

Josef%20Hardi's gravatar image

Josef Hardi
16112
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×261
×37
×1

Asked: 10 May '13, 13:53

Seen: 11,977 times

Last updated: 20 Jul, 09:41

powered by BitNami OSQA