You need to step away from the syntax and think about the conceptual model. In your model, you have workers, projects, companies, and departments. I recommend you represent all of these as classes in your RDF model.
ex:Worker a rdfs:Class .
ex:Project a rdfs:Class .
ex:Company a rdfs:Class .
ex:Department a rdf:Class .
(as an aside, I'm using Turtle syntax for RDF instead of RDF/XML, because it is far easier to read and edit, and makes the actual structure of your data far clearer. I really recommend you learn it and use it instead of RDF/XML)
However, you also want to say things about the employment of certain people in certain projects/companies/departments (such as when they started and when they stopped working there). This means that you need to represent that relationship as an object in its own right, so that you can say things about it. For example, to express that a worker ex:worker1
was employed by company ex:apple
between two dates, and then later was employed by company ex:microsoft
you could do something like this:
ex:worker1 a ex:Worker ;
ex:name "Steve Jobs";
ex:employment ex:employment1 ;
ex:employment ex:employment2 .
ex:employment1 a ex:EmploymentRelation ;
ex:forCompany ex:apple ;
ex:startDate "20010101T00:00:00Z"^^xsd:dateTime ;
ex:endDate "20050101T00:00:00Z"^^xsd:dateTime .
ex:employment2 a ex:EmploymentRelation ;
ex:forCompany ex:microsoft ;
ex:startDate "20060101T00:00:00Z"^^xsd:dateTime ;
ex:endDate "20080101T00:00:00Z"^^xsd:dateTime .
Once you have the data modeled as above, if you wanted to do a SPARQL query asking for all people who worked for apple between two dates, you'd do something like this (as a simple example):
SELECT ?worker ?name
WHERE { ?worker a ex:Worker ;
ex:name ?name ;
ex:employment [ ex:forCompany ex:apple ;
ex:startDate ?start ;
ex:endDate ?end ] .
FILTER (?start > "20001231T00:00:00Z"^^xsd:dateTime)
FILTER (?end < "20120101T00:00:00Z"^^xsd:dateTime
}
(by the way, the above shows again why using Turtle is a good idea: Turtle syntax and the SPARQL query language are very closely matched - once you understand one, the other follows naturally).