示例#1
0
    public void Select(Statement template, StatementSink sink)
    {
        // extract the fields for easy access
        Entity   subj = template.Subject;
        Entity   pred = template.Predicate;
        Resource obj  = template.Object;

        // convert the SemWeb fields to the RDFQuery fields
        Uri    s;
        string p, o;

        rdf_to_beagle_hook(subj, pred, obj, out s, out p, out o);

        RDFQuery       query  = new RDFQuery(s, p, o);
        RDFQueryResult result = (RDFQueryResult)query.Send();

        foreach (Hit hit in result.Hits)
        {
            Entity subject = new Entity(hit.Uri.ToString());               //FIXME: Do we have to use strings here?
            foreach (Property prop in hit.Properties)
            {
                Entity   predicate = BeaglePropertyToEntity(prop.Type, prop.Key);
                Resource _object;
                property_to_rdf_hook(prop, out _object);

                // now create a the statement and add it to the result
                Statement st = new Statement(subject, predicate, _object);
                sink.Add(st);
            }
        }
    }
示例#2
0
        public override ResponseMessage Execute(RequestMessage request)
        {
            RDFQueryResult result = new RDFQueryResult();
            RDFQuery       query  = request as RDFQuery;

            if (query == null)
            {
                return(new ErrorResponse("Only RDF query please!"));
            }

            result.Hits = QueryDriver.DoRDFQuery(query);
            return(result);
        }
示例#3
0
		public override ResponseMessage Execute (RequestMessage request)
		{
			RDFQueryResult result = new RDFQueryResult ();
			RDFQuery query = request as RDFQuery;
			if (query == null)
				return new ErrorResponse ("Only RDF query please!");

			result.Hits = QueryDriver.DoRDFQuery (query);
			return result;
		}