If any of the %magics is modified in the intermediate code, then set it again when it needed
How to enable inference in Virtuoso!
For a specific SPARQL to enable inference in Virtuoso use the following statement before the prefixes in the query
DEFINE input:inference <http://dbis.ionio.gr/owl/BIBFRAME2LM>
More specificaly, in this sparql-kernel this must be defined as the first statement in the cell in the %header "line magic"
%header DEFINE input:inference <http://dbis.ionio.gr/owl/BIBFRAME2LM>
To disable reasoner in subsequent queries set header OFF option.
See Enumerate Instances cell for details.
%endpoint http://libdata.tab.ionio.gr:8890/sparql
#Due to the utilization of more than one graph, used graph is defined in from statement
# %graph http://dbis.ionio.gr/rda2bfdrvWLP
# prefixies for RDA
%prefix rdac: <http://rdaregistry.info/Elements/c/>
%prefix rdax: <http://rdaregistry.info/Elements/x/>
%prefix rdaxo: <http://rdaregistry.info/Elements/x/object/>
%prefix rdaw: <http://rdaregistry.info/Elements/w/>
%prefix rdawo: <http://rdaregistry.info/Elements/w/object/>
%prefix rdawd: <http://rdaregistry.info/Elements/w/datatype/>
%prefix rdae: <http://rdaregistry.info/Elements/e/>
%prefix rdaeo: <http://rdaregistry.info/Elements/e/object/>
%prefix rdamo: <http://rdaregistry.info/Elements/m/object/>
%prefix rdamd: <http://rdaregistry.info/Elements/m/datatype/>
# prefixies for bibframe
%prefix bf: <http://id.loc.gov/ontologies/bibframe/>
# %display table withtypes
%display table
%show all
%display diagram
CONSTRUCT{
?s ?p ?o.
?o ?p1 ?o1.
}
FROM <http://dbis.ionio.gr/grdadrv>
WHERE {
?s ?p ?o;
a rdac:C10001.
?s rdfs:comment ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily"@en).
FILTER EXISTS {{?o a rdac:C10001} UNION {?o a rdac:C10006} } # W -2- W, W -2- E
FILTER (?p = rdawo:P10016 or ?p = rdawo:P10099 or ?p = rdawo:P10113 or
?p = rdawo:P10147 or ?p = rdawo:P10155 or ?p = rdawo:P10170 or
?p = rdawo:P10236 or ?p = rdawo:P10257 or ?p = rdawo:P10291 or
?p = rdawo:P10078).
OPTIONAL{
?o ?p1 ?o1.
FILTER EXISTS {?o1 a rdac:C10006 } # E -2- E
FILTER (?p1 = rdaeo:P20076 or ?p1 = rdaeo:P20110 or ?p1 = rdaeo:P20145 or
?p1 = rdaeo:P20153 or ?p1 = rdaeo:P20166 or ?p1 = rdaeo:P20171 or
?p1 = rdaeo:P20203 or ?p1 = rdaeo:P20211).
}
}
%display diagram svg withliterals
%lang en
CONSTRUCT{
?s ?p ?o.
?o ?p1 ?o1.
?s rdfs:label ?workID.
?o rdfs:label ?workExpID.
?o1 rdfs:label ?expID.
}
FROM <http://dbis.ionio.gr/grdadrv>
WHERE {
?s a rdac:C10001;
rdfs:comment ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily"@en).
?s ?p ?o.
FILTER EXISTS {{?o a rdac:C10001} UNION {?o a rdac:C10006} } # W -2- W, W -2- E
FILTER (?p = rdawo:P10016 or ?p = rdawo:P10099 or ?p = rdawo:P10113 or
?p = rdawo:P10147 or ?p = rdawo:P10155 or ?p = rdawo:P10170 or
?p = rdawo:P10236 or ?p = rdawo:P10257 or ?p = rdawo:P10291 or
?p = rdawo:P10078).
OPTIONAL{
?o ?p1 ?o1.
FILTER EXISTS {?o1 a rdac:C10006 } # E -2- E
FILTER (?p1 = rdaeo:P20076 or ?p1 = rdaeo:P20110 or ?p1 = rdaeo:P20145 or
?p1 = rdaeo:P20153 or ?p1 = rdaeo:P20166 or ?p1 = rdaeo:P20171 or
?p1 = rdaeo:P20203 or ?p1 = rdaeo:P20211).
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a Work matching key
?o1 rdfs:label ?expID.
}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a Work matching key
?s rdfs:label ?workID
}
OPTIONAL { # when debug, use it as optional to find also works without a Work matching key
?o rdfs:label ?workExpID
}
}
%display diagram svg
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
}
FROM <http://dbis.ionio.gr/gBF2drv>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:note ?wf.
?wf bf:noteType ?ntype;
rdfs:label ?familyLabel.
FILTER (?ntype = "BibFamily" and ?familyLabel = "WutheringHeightsFamily"@en).
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
}
}
%display diagram svg withliterals
%lang en
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
?w rdfs:label ?workID.
?o rdfs:label ?oID.
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID.
# ?o bf:code ?oID.
}
FROM <http://dbis.ionio.gr/gBF2drv>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:note ?wf.
?wf bf:noteType ?ntype;
rdfs:label ?familyLabel.
FILTER (?ntype = "BibFamily" and ?familyLabel = "WutheringHeightsFamily"@en).
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID. # Alternative information to used as matching key
}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?w rdfs:label ?workID.
# ?w bf:code ?workID # Alternative information to used as matching key
}
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o rdfs:label ?oID.
# ?o bf:code ?oID # Alternative information to used as matching key
}
}
%display diagram svg
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
}
FROM <http://dbis.ionio.gr/rda2bfdrvWLP>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:code ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily").
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
}
}
%display diagram svg withliterals
%lang en
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
?w rdfs:label ?workID.
?o rdfs:label ?oID.
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID.
# ?o bf:code ?oID.
}
FROM <http://dbis.ionio.gr/rda2bfdrvWLP>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:code ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily").
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID. # Alternative information to used as matching key
}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?w rdfs:label ?workID.
# ?w bf:code ?workID # Alternative information to used as matching key
}
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o rdfs:label ?oID.
# ?o bf:code ?oID # Alternative information to used as matching key
}
}
%display diagram svg
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
}
FROM <http://dbis.ionio.gr/rda2bfdrv>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:code ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily").
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
}
}
%display diagram svg withliterals
%lang en
CONSTRUCT{
?w ?p ?o.
?o ?p1 ?o1.
?w rdfs:label ?workID.
?o rdfs:label ?oID.
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID.
# ?o bf:code ?oID.
}
FROM <http://dbis.ionio.gr/rda2bfdrv>
WHERE {
# w - w
# w - i
{?w a bf:Work} UNION {?w a bf:Text}
UNION
{?w a bf:Cartography} UNION {?w a bf:Audio}
UNION
{?w a bf:NotatedMusic} UNION {?w a bf:NotatedMovement}
UNION
{?w a bf:Dataset} UNION {?w a bf:StillImage}
UNION
{?w a bf:MovingImage} UNION {?w a bf:Object}
UNION
{?w a bf:Multimedia} UNION {?w a bf:MixedMaterial}
?w bf:code ?familyLabel.
FILTER (?familyLabel = "WutheringHeightsFamily").
?w ?p ?o.
FILTER (?p = bf:translation or ?p = bf:hasDerivative or
?p = bf:hasExpression or ?p = bf:otherEdition or
?p = bf:hasPart or
?p = bf:hasInstance or ?p = bf:accompaniedBy).
FILTER EXISTS {
{?o a bf:Work} UNION {?o a bf:Text}
UNION
{?o a bf:Cartography} UNION {?o a bf:Audio}
UNION
{?o a bf:NotatedMusic} UNION {?o a bf:NotatedMovement}
UNION
{?o a bf:Dataset} UNION {?o a bf:StillImage}
UNION
{?o a bf:MovingImage} UNION {?o a bf:Object}
UNION
{?o a bf:Multimedia} UNION {?o a bf:MixedMaterial}
UNION
{?o a bf:Instance} UNION {?o a bf:Archival}
UNION
{?o a bf:Electronic} UNION {?o a bf:Manuscript}
UNION
{?o a bf:Print} UNION {?o a bf:Tactile}
}
OPTIONAL {
?o ?p1 ?o1
FILTER EXISTS {
{?o1 a bf:Instance} UNION {?o1 a bf:Archival}
UNION
{?o1 a bf:Electronic} UNION {?o1 a bf:Manuscript}
UNION
{?o1 a bf:Print} UNION {?o1 a bf:Tactile}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o1 rdfs:label ?instanceID.
# ?w bf:code ?workID. # Alternative information to used as matching key
}
}
# get instances' label
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?w rdfs:label ?workID.
# ?w bf:code ?workID # Alternative information to used as matching key
}
OPTIONAL { # when debug, use it as optional to find also works without a matching key
?o rdfs:label ?oID.
# ?o bf:code ?oID # Alternative information to used as matching key
}
}