I am very new to rdf/semantic web. I have used Field collection module in my project. I have add file field and taxonomy tag to field collection. My objective is to add tag to each file uploaded for a particular content type, that is, file tagging, and also the tag on a file appear in the RDF triple store similar to how tags work on nodes.
In triple store field_collection_item is coming as

<binding name="o">
    <uri>http://<base-url>/field_collection_item/<collection-id></uri>
</binding>

Can we see the relationships between the file and tags of field collection in the triple store.
Or how can I show files and tags in triple store. Or in general can we represent these sub fields of field collection in the RDFa. I am very new to RDF/semantic web. Will you please elaborate on the probable solutions ?

Thank you

Comments

scor’s picture

yes, http://<base-url>/field_collection_item/<collection-id> is how the URI for your field collection items is constructed.

Can we see the relationships between the file and tags of field collection in the triple store.

as far as I can tell from your example, the tags belong to the field collection (and not to the file directly). Maybe what you need instead is fieldable file fields? have you tried http://drupal.org/project/file_entity?

Romi’s picture

Thank you very much sir for your quick reply. I tried the file_entity module previously. But I could not get any proper solution. My objective is to get representation of tag of the field collection in the triple store. Sir, I will be thankful to you if you guide me with your valuable input. Thank you again.

scor’s picture

Do you get all the data you want if you go to http://<base-url>/field_collection_item/<collection-id>.rdf? (note the .rdf at the end)

Romi’s picture

Yes sir, I am getting like this

<rdf:RDF>
   <rdf:Description rdf:about="http://<base-url>/field_collection_item/9">
        <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
        <dc:subject rdf:resource="http://<base-url>/taxonomy_term/686"/>
        <foaf:familyName rdf:resource="http://<base-url>/taxonomy_term/657"/>
   </rdf:Description>
</rdf:RDF>

sir, the taxonomy term 'tag' related to field collection item is coming here. That means my problem is already solved? Or I need to do something else?

Thank you sir.

scor’s picture

well, if all the data is there, then you are good. It should also appear in the SPARQL endpoint, except that to reach the tag when writing a SPARQL query, you will need to take into account the intermediary field collection item:
node -> field_collection_item -> tag

wcorbett’s picture

Hi,

Thanks for your help on this issue. I'm on the same team as user Romi and we've been working with this issue. We find that with using field collection module we can access the field collection contents at [nodeID].rdf but the contents don't seem to be accessible through the SPARQL endpoint.

We've also verified on a second installation that sparql endpoint doesn't recurse into field collections, yet the content is accessible via the .rdf page.

Again to resummarize this issue we're finding that fields created via the field collection module arn't accessible via the sparql endpoint yet are accessible if you access the rdf directly. We expect that if we search for the field collection ID as a subject in the triple store we find its child content but that's not the case.

Thanks and let me know if I need to clarify as I may be using some terms wrong,

scor’s picture

Project: RDF Extensions » SPARQL

ok, so if all your data is available at the respective entities' .rdf URI, then it looks like this issue is about SPARQL.

The latest patch of #1389718: rebuild endpoint does not cover all entities should solve your problem, please try it out and report there if it works.

wcorbett’s picture

Resurrecting an old thread.

So we have a field collection with fields attachment and tag. In the RDF we can successfuly link the field collection ID to a given tag but we are unable to link it to the attachment name or path.

For example we have field_collection_1 with fields attachment and tag
Given the instance:
field_collection_1
attachment: attachment_a
tag: resource

The rdf looks like

resource (tag)

We would like another triple something like but there is nothing for the file. We have able to give an RDF mapping to the attachment field itself but can't find it in the rdf output.

Thanks,

sessaid’s picture

Few more comments regarding generated RDF from field collections. I am still new to Drupal but I am under the impression that the RDF generation described below is currently not possible. Also, I am working with Will in #8 so the posts are related to the same project.

We chose to use a field collection as a workaround for relating one field to another. Specifically, if we have:

content type node -> has_file_attachment (field name) -> file (a file datatype value)

and we need to be able to add:

file -> has_tag -> some drupal term

The only solution seems to be a field collection. However, in a field collection, the relationships between the different fields in the collection is not explicit in this case. For example, a field collection could look like:

field collection -> has file attachment -> file
field collection -> has tag -> a tagging term

and it is not explicit that the "tag" is a tag of the "file". Also, it is not possible to generate the following triples from the above example:

content type node -> has file attachment -> file.
file -> has tag -> tagging term.

It would be really useful, from the RDF perspective, if we can mark one or more fields in the collection as being the "primary" fields. This information could then be used to generate RDF like the following. If we have the following structure in Drupal:

some node -> has field collection (mapped to a has_attachment predicate) -> field collection A

field collection A -> has file (primary field) -> file
-> has tag -> tag

The above can then be translated to the following RDF:

some node -> has_attachment -> file.
file -> has_tag -> tag.

What the "primary" mark does is:
1. Skip over the "field collection instance" when using the mapping predicate for the field collection and use instead the fields that are marked "primary". In other words, the object of the predicate would become the "primary" fields instead of the field collection instance.

2. For each "non-primary" field in the collection, create a triple where the subject is the "primary" filed value, the predicate is the predicate mapping for the "non-primary" field, and the object is the "non-primary" field.

This above will help us use field collections to create graphs but at the same time hide these intermediate collection instances. We really don't want to have to deal with the field collection instance in the RDF graph because the RDF data model doesn't need "grouping" nodes like these. Also, these additional nodes break the semantics that are asserted in the OWL Ontology being used in this project and this limits our capabilities for using semantic SPARQL queries.

Thank you,