database icon indicating copy to clipboard operation
database copied to clipboard

Blazegraph INFERENCE

Open redskate opened this issue 9 years ago • 4 comments

Hello again dear community

Thank you so far for helping/answering my questions. I am experiencing a more or less unexpected behaviour concerning inference while inserting "similar" (but not same) RDF Entities via SPARQL-UPDATE after having loaded an OWL ontology on Blazegraph 1.2.4 - the current one (thank you!).

The namespace options:

demo_TESTINFERENCE2

com.bigdata.rdf.store.AbstractTripleStore.justifytrue
com.bigdata.rdf.sail.namespacedemo_TESTINFERENCE2
com.bigdata.relation.classcom.bigdata.rdf.store.LocalTripleStore
com.bigdata.rdf.sail.truthMaintenancetrue
com.bigdata.btree.writeRetentionQueue.capacity16000
com.bigdata.rdf.store.AbstractTripleStore.textIndextrue
com.bigdata.search.FullTextIndex.fieldsEnabledfalse
com.bigdata.relation.namespacedemo_TESTINFERENCE2
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClasscom.bigdata.rdf.vocab.core.BigdataCoreVocabulary_v20160317
com.bigdata.rdf.store.AbstractTripleStore.quadsfalse
com.bigdata.relation.containerdemo_TESTINFERENCE2
com.bigdata.journal.AbstractJournal.bufferModeDiskRW
com.bigdata.rdf.sail.bufferCapacity5000000

The behaviour is observed while updating (SPARQL-UPDATE) the namespace using twice the same query below with two different subjects (once with subject http://semweb.ch/base/9 and once with http://semweb.ch/base/19, also changing the prefLabel from "CCC9" to resp. "CCC19" to distinguish the entities also by a prefLabel (see below). This query just creates one concept scheme adding some attributes to it.

prefix skos: http://www.w3.org/2004/02/skos/core# prefix skosxl: http://www.w3.org/2008/05/skos-xl# prefix dcterms: http://purl.org/dc/terms/ prefix semwebo: http://semweb.ch/onto/ prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# prefix rdfs: http://www.w3.org/2000/01/rdf-schema# prefix dc: http://purl.org/dc/elements/1.1/ prefix cco: http://creativecommons.org/ns# prefix foaf: http://xmlns.com/foaf/0.1/ prefix void: http://rdfs.org/ns/void# prefix nkos: http://purl.org/nkos/ INSERT { http://semweb.ch/base/9 rdf:type skos:ConceptScheme. http://semweb.ch/base/9 skos:prefLabel "CCC9"@en. http://semweb.ch/base/9 dcterms:created "2016-11-27T13:09:14.332+01:00"^^http://www.w3.org/2001/XMLSchema#dateTime. http://semweb.ch/base/9 dcterms:creator "Please specify". http://semweb.ch/base/9 dcterms:subject "Please specify"@en. http://semweb.ch/base/9 dcterms:title "Please specify"@en. http://semweb.ch/base/9 dcterms:description "Please specify"@en. http://semweb.ch/base/9 dcterms:hasVersion "Please specify". http://semweb.ch/base/9 dcterms:modified "2016-11-27T13:09:14.332+01:00"^^http://www.w3.org/2001/XMLSchema#dateTime. http://semweb.ch/base/9 dcterms:identifier "Please specify". http://semweb.ch/base/9 dc:publisher "Please specify". http://semweb.ch/base/9 dcterms:rights "Please specify". http://semweb.ch/base/9 cco:license "Please specify". http://semweb.ch/base/9 cco:morePermissions "Please specify". http://semweb.ch/base/9 cco:attributionURL "Please specify". http://semweb.ch/base/9 cco:attributionName "Please specify". http://semweb.ch/base/9 foaf:homepage "Please specify". http://semweb.ch/base/9 foaf:page "Please specify". http://semweb.ch/base/9 dcterms:issued "Please specify". http://semweb.ch/base/9 nkos:sizeNote "Please specify". http://semweb.ch/base/9 nkos:kosType "Please specify". http://semweb.ch/base/9 nkos:updateFrequency "Please specify". http://semweb.ch/base/9 void:vocabulary "Please specify". http://semweb.ch/base/9 void:sparqlEndpoint "Please specify". http://semweb.ch/base/9 void:rootResource "Please specify". http://semweb.ch/base/9 void:exampleResource "Please specify". http://semweb.ch/base/9 void:feature "Please specify". http://semweb.ch/base/9 owl:versionInfo "Please specify". } WHERE {}

Issuing these two SPARQL-Queries on a fresh created Blazegraph namespace results in a correct exploration of the URI's http://semweb.ch/base/9, resp. http://semweb.ch/base/19 showing each a distinct entity, one for each URI.

The "unexpected" thing: In case I load - again on a fresh created namespace with the same options - the well-known FOAF ontology from http://xmlns.com/foaf/spec/20140114.rdf and then issue both (different) insertion queries (see above), the result of exploration of the URI's http://semweb.ch/base/9, resp. http://semweb.ch/base/19 shows an interesting outcome (see below) where both terms are linked via a "sameAs" predicate and the attributes are merged in each of the entities:

Exploring http://semweb.ch/base/9 gives a similar outcome as exploring http://semweb.ch/base/19:

<http://semweb.ch/base/9>

Outgoing Links

rdf:typeowl:Thing
rdf:typeskos:ConceptScheme
owl:sameAs" rel="nofollow" target="_blank" ><http://semweb.ch/base/19>

Attributes

" rel="nofollow" target="_blank" ><http://creativecommons.org/ns#attributionName>Please specify
" rel="nofollow" target="_blank" ><http://creativecommons.org/ns#attributionURL>Please specify
" rel="nofollow" target="_blank" ><http://creativecommons.org/ns#license>Please specify
" rel="nofollow" target="_blank" ><http://creativecommons.org/ns#morePermissions>Please specify
dcterm:created2016-11-27T12:09:14.332Z
dcterm:creatorPlease specify
dcterm:identifierPlease specify
dcterm:rightsPlease specify
dcterm:subjectPlease specify
" rel="nofollow" target="_blank" ><http://purl.org/nkos/kosType>Please specify
" rel="nofollow" target="_blank" ><http://purl.org/nkos/sizeNote>Please specify
" rel="nofollow" target="_blank" ><http://purl.org/nkos/updateFrequency>Please specify
owl:versionInfoPlease specify
foaf:homepagePlease specify
foaf:isPrimaryTopicOfPlease specify
foaf:makerPlease specify
foaf:pagePlease specify
skos:prefLabelCCC9
skos:prefLabelCCC19
dcterm:descriptionPlease specify
dcterm:hasVersionPlease specify
dcterm:issuedPlease specify
dcterm:modified2016-11-27T12:09:14.332Z
dcterm:titlePlease specify
dc:publisherPlease specify
void:exampleResourcePlease specify
void:featurePlease specify
void:rootResourcePlease specify
void:sparqlEndpointPlease specify
void:vocabularyPlease specify

Of course, this interesting result is not what I need here - I would just need both entities separately in the RDF store. This behaviour appears only after having loaded the OWL FOAF ontology.

First question: Please what can I do in order to create but also select both entities separately ? Note that these entities (creation of Concept Schemes) can and should created at any time, before or after having loaded an ontology. Of course up to now I need truth maintenance (otherwise I would have to implement it by myself, this would explode the implementation time).

Second question: Obviously this is one of the (hidden?) behaviours of Blazegraph inferences, which are sketched (just sketched) at https://wiki.blazegraph.com/wiki/index.php/InferenceAndTruthMaintenance (thank you), -> Is there please a white paper or a real explanatory link (or maybe a web page) explaining what exactely is done on which option by the inference engine ?

Thank you in advance Regards

redskate avatar Nov 27 '16 14:11 redskate

There is the same foaf:homepage specified for both subjects in question. That actually triggers inferencing of sameAs and other side-effects you are observing.

Note, that foaf:homepage is InverseFunctionalProperty:

  <rdf:Property rdf:about="http://xmlns.com/foaf/0.1/homepage" vs:term_status="stable" rdfs:label="homepage" rdfs:comment="A homepage for some thing.">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/page"/>
    <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/isPrimaryTopicOf"/>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/>
    <!--  previously: rdfs:domain rdf:resource="http://xmlns.com/foaf/0.1/Agent" -->
    <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdfs:range rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
    <rdfs:isDefinedBy rdf:resource="http://xmlns.com/foaf/0.1/"/>
  </rdf:Property>

And by definition, subjects referencing the same object with InverseFunctionalProperty are equal:

P rdf:type owl:InverseFunctionalProperty.
s1 P,o. s2 P o => s1=s2

igor-kim avatar Dec 09 '16 06:12 igor-kim

This effect happens to an entity which is not bound (via rdfs:subClass) to any of the FOAF classes and hence to any of the inverseFunctionalProperty props.

So the equivalence on that entities seems to be inferred wrongly.

Anyway, thank you very much for the hint. Blazegraph Truth maintenance seems to be to “fat" for my case, it needs 2-5 seconds response time at each small deletion/insertion and this already with a tiny ontology and some dozens extra triples. I will manage it by java.

On 9 Dec 2016, at 07:29, igor-kim [email protected] wrote:

There is the same foaf:homepage specified for both subjects in question. That actually triggers inferencing of sameAs and other side-effects you are observing.

Note, that foaf:homepage is InverseFunctionalProperty:

<rdf:Property rdf:about="http://xmlns.com/foaf/0.1/homepage" vs:term_status="stable" rdfs:label="homepage" rdfs:comment="A homepage for some thing."> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/page"/> <rdfs:subPropertyOf rdf:resource="http://xmlns.com/foaf/0.1/isPrimaryTopicOf"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#InverseFunctionalProperty"/> <rdfs:domain rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> <rdfs:range rdf:resource="http://xmlns.com/foaf/0.1/Document"/> <rdfs:isDefinedBy rdf:resource="http://xmlns.com/foaf/0.1/"/> </rdf:Property> And by definition https://www.w3.org/TR/2008/WD-owl2-quick-reference-20081202/#OWL.2FOWL_2_Vocabulary, subjects referencing the same object with InverseFunctionalProperty are equal:

P rdf:type owl:InverseFunctionalProperty. s1 P,o. s2 P o => s1=s2 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/blazegraph/database/issues/35#issuecomment-265943691, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7rrQTethcniDyNQa-GtK48xvBUqDOBks5rGPU8gaJpZM4K9KrH.

redskate avatar Dec 09 '16 09:12 redskate

There are following triples: <http://semweb.ch/base/9> foaf:homepage "Please specify". <http://semweb.ch/base/19> foaf:homepage "Please specify". inference rule for InverseFunctionalProperty does not require assigning subclasses, above triples in conjunction with FOAF ontology trigger inference rule. OWL ontology is heavy one, inferring much (not always expected). RDFS-only inferencing provides better performance: com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.RdfsAxioms

igor-kim avatar Dec 09 '16 10:12 igor-kim

@redskate , please review this issue. Is there anything that still needs resolution?

igor-kim avatar Jan 09 '17 10:01 igor-kim