Question

What I want to do is to get the property list from the Individual1 or from a class, Get all properties from "something" The result should be something like this (for Secret_Data):

| Asset_has_Confidentiality_Importance | High                                       |
| Asset_has_Availability_Importance....| Moderate                                   |
| Asset_has_Integrity_Importance.......| Moderate                                   |
| Asset_threatenedBy_ThreatEvent.......| Compromise_sensitive_information           |
| Asset_threatenedBy_ThreatEvent.......| Disclosure_of_sensitive_information        |
| Asset_threatenedBy_ThreatEvent.......| Exploit_exposed_unauthorized_information   |
| Asset_threatenedBy_ThreatEvent.......| Integrity_loss_by_corrupting_critital_data |
<owl:NamedIndividual rdf:about="&securityOntology_ITESM_UC3M;Secret_Data">
    <rdf:type rdf:resource="&securityOntology_ITESM_UC3M;Data"/>
    <Asset_has_Confidentiality_Importance rdf:datatype="&xsd;string">High</Asset_has_Confidentiality_Importance>
    <Asset_has_Availability_Importance rdf:datatype="&xsd;string">Moderate</Asset_has_Availability_Importance>
    <Asset_has_Integrity_Importance rdf:datatype="&xsd;string">Moderate</Asset_has_Integrity_Importance>
    <Asset_threatenedBy_ThreatEvent rdf:resource="&securityOntology_ITESM_UC3M;Compromise_sensitive_information"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="&securityOntology_ITESM_UC3M;Disclosure_of_sensitive_information"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="&securityOntology_ITESM_UC3M;Exploit_exposed_unauthorized_information"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="&securityOntology_ITESM_UC3M;Integrity_loss_by_corrupting_critital_data"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="&securityOntology_ITESM_UC3M;Obtain_unauthorized_access"/>
</owl:NamedIndividual>

I think the query is something like this, (But the value is not well formatted, and some properties are not importart like "type property"):

PREFIX css:<http://www.semanticweb.org/evalues/ontologies/2014/3/securityOntology_ITESM_UC3M#>

SELECT DISTINCT ?property ?value
WHERE {
  css:Secret_Data ?property ?value.
}
Was it helpful?

Solution

Answer to updated question (a query about individuals)

It's much easier to answer question with complete sample data. If we bundle up the data that you've given with appropriate namespace declarations, we end up with something like this:

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="http://stackoverflow.com/q/23223447/1281433/">
  <owl:NamedIndividual rdf:about="http://stackoverflow.com/q/23223447/1281433/Secret_Data">
    <Asset_has_Availability_Importance rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Moderate</Asset_has_Availability_Importance>
    <rdf:type rdf:resource="http://stackoverflow.com/q/23223447/1281433/Data"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="http://stackoverflow.com/q/23223447/1281433/Integrity_loss_by_corrupting_critital_data"/>
    <Asset_has_Integrity_Importance rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >Moderate</Asset_has_Integrity_Importance>
    <Asset_threatenedBy_ThreatEvent rdf:resource="http://stackoverflow.com/q/23223447/1281433/Obtain_unauthorized_access"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="http://stackoverflow.com/q/23223447/1281433/Disclosure_of_sensitive_information"/>
    <Asset_threatenedBy_ThreatEvent rdf:resource="http://stackoverflow.com/q/23223447/1281433/Compromise_sensitive_information"/>
    <Asset_has_Confidentiality_Importance rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
    >High</Asset_has_Confidentiality_Importance>
    <Asset_threatenedBy_ThreatEvent rdf:resource="http://stackoverflow.com/q/23223447/1281433/Exploit_exposed_unauthorized_information"/>
  </owl:NamedIndividual>
</rdf:RDF>

It's often helpful to view this in Turtle serialization, since it will look more like the query. The data is the same though, and the query will run against the data in either serialization, of course.

@prefix :      <http://stackoverflow.com/q/23223447/1281433/> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

:Secret_Data  a  owl:NamedIndividual , :Data ;
        :Asset_has_Availability_Importance
                "Moderate"^^<http://www.w3.org/2001/XMLSchema#string> ;
        :Asset_has_Confidentiality_Importance
                "High"^^<http://www.w3.org/2001/XMLSchema#string> ;
        :Asset_has_Integrity_Importance
                "Moderate"^^<http://www.w3.org/2001/XMLSchema#string> ;
        :Asset_threatenedBy_ThreatEvent
                :Integrity_loss_by_corrupting_critital_data , :Obtain_unauthorized_access , :Disclosure_of_sensitive_information , :Compromise_sensitive_information , :Exploit_exposed_unauthorized_information .

You can use a query like the following:

prefix :    <http://stackoverflow.com/q/23223447/1281433/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

select distinct ?property ?value where {
  :Secret_Data ?property ?value .
}
---------------------------------------------------------------------------------------
| property                              | value                                       |
=======================================================================================
| rdf:type                              | owl:NamedIndividual                         |
| :Asset_has_Availability_Importance    | "Moderate"^^xsd:string                      |
| rdf:type                              | :Data                                       |
| :Asset_threatenedBy_ThreatEvent       | :Integrity_loss_by_corrupting_critital_data |
| :Asset_has_Integrity_Importance       | "Moderate"^^xsd:string                      |
| :Asset_threatenedBy_ThreatEvent       | :Obtain_unauthorized_access                 |
| :Asset_threatenedBy_ThreatEvent       | :Disclosure_of_sensitive_information        |
| :Asset_threatenedBy_ThreatEvent       | :Compromise_sensitive_information           |
| :Asset_has_Confidentiality_Importance | "High"^^xsd:string                          |
| :Asset_threatenedBy_ThreatEvent       | :Exploit_exposed_unauthorized_information   |
---------------------------------------------------------------------------------------

If you don't want rdf:type in there, you could use filter ?property != rdf:type, or if there are multiple properties that you want to exclude, filter ( ?property NOT IN ( rdf:type … ) ):

prefix :    <http://stackoverflow.com/q/23223447/1281433/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

select distinct ?property ?value where {
  :Secret_Data ?property ?value .
  filter ( ?property not in ( rdf:type ) )
}
---------------------------------------------------------------------------------------
| property                              | value                                       |
=======================================================================================
| :Asset_has_Availability_Importance    | "Moderate"^^xsd:string                      |
| :Asset_threatenedBy_ThreatEvent       | :Integrity_loss_by_corrupting_critital_data |
| :Asset_has_Integrity_Importance       | "Moderate"^^xsd:string                      |
| :Asset_threatenedBy_ThreatEvent       | :Obtain_unauthorized_access                 |
| :Asset_threatenedBy_ThreatEvent       | :Disclosure_of_sensitive_information        |
| :Asset_threatenedBy_ThreatEvent       | :Compromise_sensitive_information           |
| :Asset_has_Confidentiality_Importance | "High"^^xsd:string                          |
| :Asset_threatenedBy_ThreatEvent       | :Exploit_exposed_unauthorized_information   |
---------------------------------------------------------------------------------------

Answer to the original question (a query about classes)

In the original version of the question, you gave this image of your ontology and asked for results that are after it:

enter image description here

| numberChapters  | 1 |
| numberPages     | 5 |

In the RDF/XML serialization of that ontology (since removed from the question), the description of the Psicology class was as follows:

<owl:Class rdf:about="http://webprotege.stanford.edu/RiMIUJzVuVHCr4Ke4TkFwX">
    <rdfs:label>Psicology</rdfs:label>
    <rdfs:subClassOf rdf:resource="http://webprotege.stanford.edu/RDHbMG5sh4tyJ6ZoHwxLBHk"/>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://webprotege.stanford.edu/R9DdxIZDrtXApiHoBJ6NmAy"/>
            <owl:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">5</owl:hasValue>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://webprotege.stanford.edu/R8WDOefPWzIoTChbjV31ela"/>
            <owl:hasValue rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</owl:hasValue>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>

or in the more human-readable Turtle notation:

<http://webprotege.stanford.edu/RiMIUJzVuVHCr4Ke4TkFwX>
        a                owl:Class ;
        rdfs:label       "Psicology" ;
        rdfs:subClassOf  <http://webprotege.stanford.edu/RDHbMG5sh4tyJ6ZoHwxLBHk> ;
        rdfs:subClassOf  [ a               owl:Restriction ;
                           owl:hasValue    5 ;
                           owl:onProperty  <http://webprotege.stanford.edu/R9DdxIZDrtXApiHoBJ6NmAy>
                         ] ;
        rdfs:subClassOf  [ a               owl:Restriction ;
                           owl:hasValue    1 ;
                           owl:onProperty  <http://webprotege.stanford.edu/R8WDOefPWzIoTChbjV31ela>

says that Psicology (which is usually spelled Psychology in English, by the way) is a subclass of the class of things that have the value 5 for the property numPages and the things that have the value 1 for the property numChapters. Psicology is also a subclass of Libray. (Is this supposed to be Library?)

These seem like strange axioms to me, and I wonder if there might be some sort of modeling error going on. I'm not sure what a Psicology is, but you're saying that for any Psicology p, it's the case that numPages(p,5) and numChapters(p,1). Is that really what you want to do?

At any rate, given your data, we can retrieve the results that you want. Looking at the Turtle serialization is useful, because it's very similar to the SPARQL query syntax. The query you want is:

prefix owl:   <http://www.w3.org/2002/07/owl#> 
prefix :      <http://webprotege.stanford.edu/project/Bnag2Z5E4j78tB27NnLq1L#> 
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> 

select ?property ?value where {
  ?class rdfs:label "Psicology" ;
         rdfs:subClassOf [ owl:hasValue ?value ; 
                           owl:onProperty [ rdfs:label ?property ] ] .
}
-------------------------
| property      | value |
=========================
| "numChapters" | 1     |
| "numPages"    | 5     |
-------------------------
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top