Previous Topic

Next Topic

Filesystem Models

Filesystem models are special instances of external resolvers that work in conjunction with the internal system model. In this way they are similar to views except that they gather information about files on a local drive instead of models. See the Views section for more information about views.

The capabilities of filesystem models include the ability to:

  • Specify the files and directories to include or exclude.
  • Query against filesystems to retrieve file metadata.

In This Section

Creating Filesystem Models

Updating Filesystem Models

Querying Filesystem Models

See Also

Advanced iTQL Operations

Views

Full-Text Models

Datatyping Models

Nodetyping Models

Creating Filesystem Models

You can create filesystem models by:

  1. Using the iTQL create command, creating a model of type http://tucana.org/tucana#FileSystemModel. This creates a filesystem model, plus a filesystem definition model.
  2. Loading RDF that represents the directories and files to include or exclude into the filesystem definition model.

Use the drop command to remove a filesystem model.

Note - Ensure that you drop the filesystem model and not the filesystem definition model. Dropping the filesystem model automatically drops the filesystem definition model as well. Dropping the filesystem definition model leaves the filesystem model behind.

Updating Filesystem Models

Filesystem models are designed to query for filesystem information. Rather than the entire file system, you might only be interested in specific subsections of the filesystem, and within those subsections, there might be files and directories you want to exclude because they contain irrelevant data.

This include and exclude functionality is provided by the filesystem definition model. Statements specifying the files and directories to include or exclude are loaded into the filesystem definition model using the insert command.

The following example shows how to include a specific directory for your filesystem model (assuming that you have already created a filesystem model called cDrive):

insert $x <http://www.tucanatech.com/tucana/filesystem#Include> <file:///C:/myDocuments>
into <rmi://mysite.com/server1?def#cDrive>;

Note - Include and exclude statements are inserted into the filesystem definition model. Statements inserted into the main filesystem model are ignored when a query is performed.

The following example shows how to exclude a directory in your filesystem model (assuming that you have already created a filesystem model called cDrive):

insert $x <http://www.tucanatech.com/tucana/filesystem#Exclude> <file:///C:/myDocuments/spreadsheets>
into <rmi://mysite.com/server1?def#cDrive>;

Note the following points about the include and exclude statements in the filesystem definition model:

  • The subject of an inclusion or exclusion statement is not important. This is why blank nodes are used.
  • Statements in the definition model that are not of the form shown in the above examples are ignored when you query the filesystem model.
  • The URIs that specify the files and directories to include or exclude must be of the file protocol. Anything else is reported as an invalid filesystem as part of the result of a filesystem model query.
  • Use the delete command to remove statements from filesystem definition models.

Querying Filesystem Models

Once the inclusions and exclusions are set up, you can query the filesystem model using the select command, as you would any other model, to generate statements about the files and directories.

The following schema is used for filesystem models:

<?xml version="1.0" encoding="UTF-8"?>

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xml:base="http://tucana.org/tucana"
xml:lang="en">

<rdfs:Class rdf:ID="File"
rdfs:label="file"
rdfs:comment="A file on an operating system">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
</rdfs:Class>

<rdfs:Class rdf:ID="Directory"
rdfs:label="directory"
rdfs:comment="A directory on an operating system">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
</rdfs:Class>

<rdfs:Class rdf:ID="Hidden"
rdfs:label="hidden file"
rdfs:comment="A hidden file on an operating system">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:subClassOf rdf:resource="#File"/>
</rdfs:Class>

<rdfs:Class rdf:ID="ReadOnly"
rdfs:label="read only file"
rdfs:comment="A read only file on an operating system">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:subClassOf rdf:resource="#File"/>
</rdfs:Class>

<rdf:Property rdf:ID="filename"
rdfs:label="filename"
rdfs:comment="Specifies the name of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</rdf:Property>

<rdf:Property rdf:ID="extension"
rdfs:label="extension"
rdfs:comment="Specifies the extension of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</rdf:Property>

<rdf:Property rdf:ID="path"
rdfs:label="path"
rdfs:comment="Specifies the path of a file (as an URI)">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</rdf:Property>

<rdf:Property rdf:ID="created"
rdfs:label="created"
rdfs:comment="Specifies the creation date of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
</rdf:Property>

<rdf:Property rdf:ID="accessed"
rdfs:label="accessed"
rdfs:comment="Specifies the last accessed date of the file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
</rdf:Property>

<rdf:Property rdf:ID="modified"
rdfs:label="modified"
rdfs:comment="Specifies the last modified date of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#dateTime"/>
</rdf:Property>

<rdf:Property rdf:ID="parent"
rdfs:label="parent"
rdfs:comment="Specifies the parent directory">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://tucana.org/tucana#Directory"/>
</rdf:Property>

<rdf:Property rdf:ID="size"
rdfs:label="size"
rdfs:comment="Specifies the size in bytes of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
</rdf:Property>

<rdf:Property rdf:ID="owner"
rdfs:label="owner"
rdfs:comment="Specifies the owner of a file">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
</rdf:Property>

<rdf:Property rdf:ID="canRead"
rdfs:label="can read"
rdfs:comment="Specifies if the file can be read (by the current user)">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</rdf:Property>

<rdf:Property rdf:ID="canWrite"
rdfs:label="can write"
rdfs:comment="Specifies if the file can be written to (by the current user)">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</rdf:Property>

<rdf:Property rdf:ID="canExecute"
rdfs:label="can execute"
rdfs:comment="Specifies if the file can be executed (by the current user)">
<rdfs:isDefinedBy rdf:resource="http://tucana.org/tucana"/>
<rdfs:domain rdf:resource="#File"/>
<rdfs:domain rdf:resource="#Directory"/>
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/>
</rdf:Property>
</rdf:RDF>

Note - Querying the filesystem definition model only returns the inclusion and exclusion statements, not the filesystem information.

Latest News

Kowari 1.1.0 Pre-release 1 Released

Kowari 1.0.5 Released

Kowari 1.0.4.1 Released

Kowari 1.0.4 Released

DAWG Evaluates iTQL

Kowari article in XML.com

Kowari mentioned on XML.com

Kowari 1.0.3 Released

Kowari Lite Introduced

Kowari 1.0.2 Released

Kowari 1.0.1 Released

View all news items


Open Source logo Tucana Technologies Logo SourceForge.net Logo

© 2001-2004 Tucana Technologies, Inc. Some rights reserved.