Create query in sparql using jena without hard coding the query? [closed] - sparql

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Can any one tell me how to create a sparql query for dbpedia using jena program without hard coding the query.. I dont want to just store the query in string and to execute it... I have no idead how to make it as i am new to sparql... Could any one plz help me..
Thanks in advance

Can you add more detail on what you want to do i.e. is there a general template to your queries or particular types of queries you want to make?
Jena does have some support for substituting variables into prepared queries so you can hard code a template and then substitute values as desired based on your inputs. But whether this is applicable depends on what queries you want to make.
As a very simple solution you can just build your querystring by string concatenation based on your inputs and then use Jena to send that to DBpedia.
Edit
See Ian's answer to your other question which shows how to do substitution of values into prepared queries using Jena

Related

Looking for a collection of data with no clear pattern [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am trying to run a query to search for a collection of data with no clear pattern, in fact it conflicts with an existing pattern.
The solution I have in mind is to run the query with an AND for all the data that does have a pattern(let's assume every other record follows pattern, except for what i am looking for, so it's basically scattered with no clear way of putting it together) and them what's left over, can be retrieved and displayed.
The solution I have in mind is to run the query with an AND for all
the data that does have a pattern
Well, if you want to find everything that doesn't follow any pattern just enclose all the patterns within brackets and combine with boolean AND.
Then just put a NOT outside the brackets.
Example:
select * from data where
NOT (CONDITION1 AND CONDITION2 AND...AND CONDITION_N)
I imagine your conditions are statements such as string comparisons using like (and wildcards) in addition to arithmetic comparisons.

update a table on my website [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Hey all and thank you in advance for any help, I have my website I'm building as a hobby I have an java app I wrote sitting on my comp, it updates certain tables and the the end result is a table shown to users, now I update the tables manually using phpmyadmin.
The question is how do I set a connection to import tables into my website DB?
I googled it before I asked, haven't found related stuff....
There are many ways to do what you want (dozens in fact). One way, that I personally use is through PHP and the $mysqli class.
Read more on mysqli here
You will need to setup a database conection, and from here you would use this connection to query your database by building SQL queries and using the $mysqli class to send them to the database.

Where can beginners run their SQL code?If it's a PL,then why it doesn't have a compiler? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am totally new to the subject of databases and I have only theoretical knowledge about it.I want to run the SQL commands I read about but totally clueless where to run it.The definition says SQL is a special purpose programming language.If so why doesn't it have a compiler?And if I have to install in a RDBMS on my computer to practice SQL, what is the one you would suggest for learners?Can SQL commands be run in all RDBMS?
I am totally despondent about it,utterly clueless.Please help me take the first step.Just a simple thing--Where on earth to run those SQL commands?
You can use http://sqlfiddle.com/ to test your queries. There you can chose a database (mysql, Oracle, Sql Server or other), generate test tables, fill them with test data and generate test queries to this data

SQL does replace and CAST on select affect the Database? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am creating a view and I was asked to do a 'replace' and a 'cast', so as an example:
SELECT CAST(qtyshipped AS INT) AS 'QTYShipped', REPLACE(itemval,'.','')
FROM Database
Within the view, should not actually change the information in the database but just in the query correct? (It works perfectly in my sandbox server but i just want to confirm)
Not a dumb question at all. And the answer is yes, it only changes the result of the query, the underlying data will remain the same.
That is already a good query. But I need to tell some points with you.
REPLACE function is case-sensitive. Although I've seen in your code that you are only replacing period.
Why is your column qtyshipped is not in numeric type? You should have change that into numeric. So you won't need casting which may lower the performance.
It will not affect your database since your are only executing SELECT not UPDATE.

What's a quick way to create SQL tables when starting out? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I find that creating SQL tables tedious when starting to create a web app (ASP/Python/PHP).
Do you guys know any tools that makes creating tables quicker and faster and easier? Thanks in advance! :-)
In my opinion writing a CREATE TABLE statement is far less tedious than writing HTML pages.
The recommended approach is to use a ER design tool co create and define your database model. Most (if not all) ER designer can then create the necessary DDL statement directly from the model.
With this approach you also have a documentation of your database model which is always a good thing.
It depends on the tools/libraries you use to create your app.
If you use an ORM, many ORMs offer you the possibility to create the database with all tables automatically, according to the classes and mappings you defined in your application.