On 02/11/13 15:56, Adeeb Noor wrote:
Hi Andy:

Thanks for the quick response. I tried CONSTRUCT and it did work out. But
how can I reformat such a query to CONSTRUCT one:

CONSTRUCT WHERE { ... }

is a shorthand for

CONSTRUCT { template } WHERE { pattern }

where the template and the pattern are the same (limited to basic graph patterns).

        Andy


SELECT DISTINCT *

  {

   ?ddi ddids:has_association ?c .

  ?ddi ddids:has_association ?c2 .

?c ddids:chemical_or_drug_affects_gene_product ?omim .

?omim ddids:gene_product_encoded_by_gene ?g .

?g ddids:gene_plays_role_in_process ?w .

?g ddids:gene_plays_role_in_process ?bp .

?bp ddids:process_involves_gene ?g2 .

?g2 ddids:gene_plays_role_in_process ?bp2 .


where I need each variable ( for example ?w, ?bp , etc) to be a new
resources.

Thanks


On Sat, Nov 2, 2013 at 6:41 AM, Andy Seaborne <[email protected]> wrote:

You need to use a CONSTRUCT query, not a SELECT one.

outputAsRDF encodes the result set (i.e. the table) as RDF - it is not the
datamodel of the original data.

CONSTRUCT allows you to create one RDF graph from data from another.

See also SPARQL Update for doign that from one graph to another in the
same database.

         Andy


On 02/11/13 05:35, Adeeb Noor wrote:

Hi guys:

I would like to save my SPARQL result coming from ResultSet into new rdf.
(new rdf resources) cause I want to do more work on this subgraph and it
has to be in the original rdf format.

I tried outputAsRDF function and it worked however the result I got the
following:

<rdf:Description rdf:nodeID="A5">
      <rs:value rdf:resource="
https://csel.cs.colorado.edu/~noor/Drug_Disease_ontology/
DDID.owl#genotypePhenotype
"/>
      <rs:variable>omimt</rs:variable>
    </rdf:Description>
    <rdf:Description rdf:nodeID="A6">
      <rs:value rdf:resource="
https://csel.cs.colorado.edu/~noor/Drug_Disease_ontology/
DDID.rdf#C0007589
"/>
      <rs:variable>w</rs:variable>
    </rdf:Description>
    <rdf:Description rdf:nodeID="A7">
      <rs:binding rdf:nodeID="A8"/>
      <rs:binding rdf:nodeID="A9"/>
      <rs:binding rdf:nodeID="A10"/>
      <rs:binding rdf:nodeID="A11"/>
      <rs:binding rdf:nodeID="A12"/>
      <rs:binding rdf:nodeID="A13"/>
      <rs:binding rdf:nodeID="A14"/>
      <rs:binding rdf:nodeID="A15"/>
      <rs:binding rdf:nodeID="A16"/>
      <rs:binding rdf:nodeID="A17"/>
      <rs:binding rdf:nodeID="A18"/>
      <rs:binding rdf:nodeID="A19"/>
      <rs:binding rdf:nodeID="A20"/>
      <rs:binding rdf:nodeID="A21"/>
      <rs:binding rdf:nodeID="A22"/>
      <rs:binding rdf:nodeID="A23"/>
      <rs:binding rdf:nodeID="A24"/>
      <rs:binding rdf:nodeID="A25"/>
      <rs:binding rdf:nodeID="A26"/>
      <rs:binding rdf:nodeID="A27"/>
    </rdf:Description>

how I can remove this nodes things and make it something like:

   <rdf:Description rdf:about="
https://csel.cs.colorado.edu/~noor/Drug_Disease_ontology/
DDID.rdf#C3229174">
      <j.0:label>Cytra-K Oral Product</j.0:label>
      <rdf:type rdf:resource="
https://csel.cs.colorado.edu/~noor/Drug_Disease_ontology/
DDID.owl#chemical
"/>
    </rdf:Description>

please help me out






Reply via email to