Building a triple store query using SQL - how to find all triples that have a common predicate and object

I have a database that acts like a triple store, except that it is just a simple MySQL database.

I want to select all triples that have a common predicate and object. Information about RDF and triplets

I am unable to process the SQL.

If I only had one predicate and object to match, I would do:

select TRIPLE from TRIPLES where PREDICATE="predicateName" and OBJECT="objectName"

      

But if I have a list (HashMap) of many (predicateName, objectName) pairs, I'm not sure what I need to do.

Please let me know if I need to provide more information, I'm not sure if I made it perfectly clear, but I am wary of providing too much information and confusing the problem.

+2


a source to share


2 answers


Probably upload your hash file to a temp table and make it JOIN

to your three-locale store.



+1


a source


select TRIPLE from TRIPLES where PREDICATE is in (?,?,?, ........) and OBJECT is in (?,?,?,?, .....)



Customize `? using HashMap.keys and HashMap.values. Depending on the language and data access method, use either associated parameters (ODBC and other methods) or extend parameters that generate sql itself.

0


a source







All Articles