I'm trying to convert data from RDF sources into the dictionary format expected by the @note2 biomedical text mining application
Specifically, I'm trying to collapse all synonyms for a concept onto one line
@note2 uses dictionaries in this format
+----------+-----------+---------------+-------------------------+
| class | term | synonyms | external IDs |
+----------+-----------+---------------+-------------------------+
| food | bread | pan|brot | source1;idA |
| nutrient | vitamin C | ascorbic acid | source1;idC|source2;idD |
+----------+-----------+---------------+-------------------------+
I can get one synonym per line with a query like this at bioportal
SELECT ?term ?syn ?extid
FROM <http://bioportal.bioontology.org/ontologies/BTO>
WHERE
{
?extid <http://bioportal.bioontology.org/metadata/def/prefLabel> ?term .
?extid <http://www.geneontology.org/formats/oboInOWL#hasRelatedSynonym> ?syn .
}
Returning something like this:
+-------------------------+-------------------------+-----------------+
| term | syn | extid |
+-------------------------+-------------------------+-----------------+
| "stomach smooth muscle" | "gastric muscle" | bto:BTO_0001818 |
| "stomach smooth muscle" | "gastric smooth muscle" | bto:BTO_0001818 |
| "stomach smooth muscle" | "stomach muscle" | bto:BTO_0001818 |
+-------------------------+-------------------------+-----------------+
So... is it possible, WITHIN SPARQL, to concatenate the synonyms and end up with something like
+-----------------------+----------------------------------------------------------------------------+-----------------+
| term | syn | extid |
+-----------------------+----------------------------------------------------------------------------+-----------------+
| stomach smooth muscle | gastric muscle|gastric smooth muscle|stomach smooth muscle |stomach muscle | bto:BTO_0001818 |
+-----------------------+----------------------------------------------------------------------------+-----------------+
I'll be using virtuoso open source, if it makes any difference.