Hi,
I have some content types on my site, all of them have the rdf mapping
uid | sioc:has_creator | rel
for the user that creates a node.
I can see the property correctly appearing in any node's page source code.
<span class="submitted"><span property="dc:date dc:created" content="2012-01-28T22:29:18+02:00" datatype="xsd:dateTime" rel="sioc:has_creator">By <span class="username" xml:lang="" about="/el/users/a_user" typeof="sioc:UserAccount" property="foaf:name">a_user</span> on Sat, 01/28/2012 - 22:29</span></span>
But I get no triples containing the sioc:has_creator predicate using the SPARQL endpoint. The only sioc predicate, that my endpoint returns triples for, is the num_replies.
I looked at the tables in the database and there are no sioc:has_creator there. That means this property was not indexed in the first place.
Is this a known issue?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | rdfx-mapping-schema-field-1431336-4.patch | 1.08 KB | djevans |
Comments
Comment #1
scor commentedThanks for the bug report! RDFx is the module responsible for building the RDF model of the node. moving to RDFx issue. I suspect this is related to entity not providing the right property, or rdfx not looking for the right property in entity API.
A quicker way to reproduce this bug without SPARQL is to install http://drupal.org/project/restws with rdfx and browse to node/1.rdf: the triple should be missing there too.
Comment #2
larjohn commentedYou are welcome!
I did install the REST Web services module and I found what you expected: the nodes obly have num_replies from sioc...
Isn't rdfx supposed to look at every mapped property of the entity? Isn't that also true for special properties like the uid of a node?
I wish I was a little less busier to track it down..
Comment #3
larjohn commentedCan anyone confirm this happens on other installations?
The easy way, go to your sparql endpoint (www.example.org/sparql) and query the following
Comment #4
djevans commentedConfirmed on a base install of 7.x with RDFx, Rest WS, SPARQL modules, also using Devel Generate.
rdfx_get_rdf_model() loops over the node entity's property info, which is supplied by entity_metadata_node_entity_property_info() in entity/modules/node.info.inc, and includes the following:
'author' doesn't exist in the node entity's default RDF mappings (found in node_rdf_mapping() in node.module), but 'uid' does.
The patch checks for a 'schema field' key in the property array and uses that value ('uid') instead of the property index ('author') to look up the correct RDF mapping for that field.
Note that the changes won't be reflected in the triplestore until each existing node is re-saved.
Comment #5
scor commentedSuper, thanks for nailing this down @djevans! I've tried the patch and it works. I'd like @larjohn to check if this works for him too, then I'll commit this patch.
Comment #6
larjohn commentedI have applied the patch @djevans posted. It seems to work form me too, even with my additions for the rev predicates (http://drupal.org/node/1073986#comment-5586796). Thanks @djevans!!
Comment #7
scor commentedThanks @larjohn for the bug report and @djevans for the patch. Fixed with http://drupalcode.org/project/rdfx.git/commit/4b67de7
Comment #8
scor commentedNow that I think about it, I forgot we have some tests in rdfx. Coverage for this bug could easily be added in the node serialization test.
Comment #9
scor commentedthis needs a patch to add a bunch of lines to an existing test at the end of rdfx.test. should not be too hard.