As I understand you, your class hierarchy is:
CreativeWork
Asset
Article
Publication
You have a few options.
Getting nothing but Article and Publication
The simplest is to say that you only want to consider values of ?type that are Article and Publication, in which case you can specify this with values:
SELECT ?id ?title ?type
WHERE
{
values ?type { Article Publication }
?asset rdf:type Asset ;
somePrefix:id ?id ;
somePrefix:title ?title ;
rdf:type ?type .
}
This is the most specific thing that you can do, and you are guaranteed that ?type will only be Article or Publication.
Getting everything but CreativeWork and Asset
Of course, you might define other subclasses later, and you might not want to have to add more types to the values block every time you do that. You might consider simply filtering out CreativeWork and Asset, then:
SELECT ?id ?title ?type
WHERE
{
?asset rdf:type Asset ;
somePrefix:id ?id ;
somePrefix:title ?title ;
rdf:type ?type .
filter ( ?type != Asset && ?type != CreativeWork )
}
You can also do that filter with:
filter ( ?type NOT IN ( Asset, CreativeWork ) )
Getting only maximally specific classes
This doesn't make any guarantee about what classes you could have, though, and if you later add subclasses of Article or Publication, e.g., JournalArticle ⊑ Article, then you'd get results that include both Article and JournalArticle, and you might not want that. What you might want instead, is the "most specific" class for an individual. That is, you want the class C of an individual such that the individual has no other type D ⊑ C. (Note that the other there is important, since C ⊑ C.) The general idea is captured in How to get Least common subsumer in ontology using SPARQL Query?, along with some other questions, but it's easy to reproduce the important part here:
SELECT ?id ?title ?type
WHERE
{
?asset rdf:type Asset ;
somePrefix:id ?id ;
somePrefix:title ?title ;
rdf:type ?type .
filter not exists { # Don't take ?type as a result if
?asset rdf:type ?subtype . # ?asset has some other ?subtype
?subtype rdfs:subClassOf* ?type . # that is a subclass of ?type
filter ( ?subtype != ?type ) # (other than ?type itself).
}
}
This will get you the "deepest" class in the hierarchy that an individual has. This still could return multiple results, if your individual is a member of classes such that neither is a subclass of the other. Of course, in that case, you'd probably still be interested in all the results.